view, LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy FROM query_1_result ✅ Query (2)
query_4_result UNION ALL SELECT "click", COUNT(DISTINCT click) FROM query_4_result UNION ALL SELECT "buy", COUNT(DISTINCT buy) FROM query_4_result Query (4)
view, LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy FROM query_1_result Back to Query (2)
BY time) AS view, LAST_VALUE(click IGNORE NULLS) OVER (PARTITION BY user ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (PARTITION BY user ORDER BY time) AS buy FROM query_1_result ✅ Query (2)
400 A 500 500 A 600 600 PARTITION BY user user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600 user time view click buy B 200 200 B 300 300
100 400 A 500 100 500 A 600 100 500 600 LAST_VALUE & PARTITION BY user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600 user time view click buy B 200 200 B 300 300 200
100 400 A 500 100 500 A 600 100 500 600 user time view click buy B 200 200 B 300 300 200 user time view click buy A 100 100 B 200 200 B 300 300 200 A 400 100 400 A 500 100 500 A 600 100 500 600 LAST_VALUE & PARTITION BY