我在尝试执行子查询时遇到以下错误子查询使用外部查询中未分组的列“s.event\u captured\u dt”
select
to_date(s.event_captured_dt,'DD Mon YYYY')
,count(*) as count_
,(select count(*)
from spc_raw_responsys_kanui.sent s1
where to_date(s1.event_captured_dt,'DD Mon YYYY') between to_date(s.event_captured_dt,'DD Mon YYYY') - 7 and to_date(s.event_captured_dt,'DD Mon YYYY')
) as count7days_
from spc_raw_responsys_kanui.sent s
where 1=1
and to_date(s.event_captured_dt,'DD Mon YYYY') >= '2020-06-01 00:00:00'
group by to_date(s.event_captured_dt,'DD Mon YYYY')
这就是我想要达到的目标:
目标
1条答案
按热度按时间0tdrvxhp1#
如果在子查询中进行预聚合,是否有效?