0
我试图从列user_id
,received_at
和event_name
列表中识别每个用户的激活事件。为了得到第一个事件,我可以使用下面的窗口函数:我可以做类似Redshift窗口函数中的条件
MIN(
CASE WHEN
e.event_name = 'User Activated'
THEN e.received_at
ELSE NULL END
) AS user_activated
是
first_value(e.received_at ignore nulls)
over (partition by e.user_id
order by e.received_at rows between unbounded preceding and unbounded following)
as first_event
我试图得到的只是具有特定名称的事件,子查询中有可能像这样的条件添加到窗口函数?
为什么不呢,你试过吗? 'first_value(case e.event_name ='User Activated'then e.received_at end ignore Nulllls)' – AlexYes
@AlexY你说得对。对不起,问一个愚蠢的问题,仍然包裹着我的头。随意添加它作为答案,我会接受它。 – KMV