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