相关子查询在 Netezza 中不起作用

Correlated subquery not working in Netezza

我在 Netezza 中有一个类似的查询,但不确定如何重写它才能正常工作。谢谢

with dates as (
      select distinct event_date from table
     )
select event_date, 
       (select count(distinct id)
        from table 
        where event_date < dates.event_date
       )
from dates

This form of correlated query is not supported - consider rewriting

无论如何,使用 window 函数会更有效率。我认为逻辑是:

select event_date, 
       sum(count(*)) over (order by event_date) - count(*) as events_before
from table
group by event_date