输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。这是您将获得最佳性能的地方该怎么做,我不需要手动输入间隔?。Sql必须为用户自动计算时间间隔。1.09-

输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。这是您将获得最佳性能的地方该怎么做,我不需要手动输入间隔?。Sql必须为用户自动计算时间间隔。1.09-,sql,sql-server,tsql,Sql,Sql Server,Tsql,输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。这是您将获得最佳性能的地方该怎么做,我不需要手动输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。在那里你会得到最好的表现 select users.uid, tran.event from public.ap


输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。这是您将获得最佳性能的地方该怎么做,我不需要手动输入间隔?。Sql必须为用户自动计算时间间隔。1.09-8.09、2.09-9.09等等,我会制作一个包含周数、开始日期、结束日期的日期表,并加入其中。在那里你会得到最好的表现
   select users.uid,
          tran.event
     from public.app_ok_cbaiodclebabababa_agg_users users
left join public.app_ok_CBAIODCLEBABABABA_agg_transactions tran  
       on users.uid=tran.uid
    where first_event_time >= '2017-09-01 0:00:00'
      and first_event_time <= '2017-09-11 0:00:00'
      and tran.event = 'successful transaction'
add this string AND  datediff(day,first_event_time, event_time)<=7 
SELECT
    users.uid,
    tran.event,
    COUNT(tran.event) Event_Count
FROM public.app_ok_cbaiodclebabababa_agg_users users
LEFT JOIN public.app_ok_CBAIODCLEBABABABA_agg_transactions tran  
    ON users.uid=tran.uid
WHERE  first_event_time >='2017-09-01 0:00:00'
    AND first_event_time <= '2017-09-11 0:00:00'
    AND tran.event='successful transaction'
GROUP BY users.uid,tran.event
select  
COUNT(*),
first_event_time
from public.app_ok_cbaiodclebabababa_agg_users users
left join public.app_ok_CBAIODCLEBABABABA_agg_transactions tran  on 
users.uid=tran.uid
where  first_event_time>='2017-09-01 0:00:00'
and first_event_time <= '2017-09-11 0:00:00'
and tran.event='successful transaction'
GROUP BY first_event_time
select x.userId,count(*) NumberOfTransaction
(
  select  
  users.uid userId,
  tran.event tEvent
  from public.app_ok_cbaiodclebabababa_agg_users users
  left join public.app_ok_CBAIODCLEBABABABA_agg_transactions tran  on 
  users.uid=tran.uid
  where  first_event_time>='2017-09-08 0:00:00'
  and first_event_time <= '2017-09-15 0:00:00'
  and tran.event='successful transaction'
) x
Group By x.userId
select u.uid, sum(t.uid)
from public.app_ok_cbaiodclebabababa_agg_users u left join
     public.app_ok_CBAIODCLEBABABABA_agg_transactions t
     on u.uid = t.uid and
        t.? >= '2017-09-08' and
        t.? < '2017-09-16' and
        t.event = 'successful transaction'
where first_event_time >= '2017-09-01' and
      first_event_time < '2017-09-12';