[英]how to calculate data at daily weekly and monthly granularity in one sql
嗯。 . . 如果我关注您的问题,您可以在子查询中使用 window 函数,然后进行过滤:
select t.*
from (select t.*,
count(*) over (partition by eventdate) as day_count,
count(*) over (partition by week) as week_count,
count(*) over (partition by month) as month_count
from t
) t
where eventdate = :transactiondate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.