WITH cte1 AS ( SELECT *, RANK() OVER(PARTITION BY user_id ORDER BY transaction_date) AS rw, LAG(spend, 1) OVER(PARTITION BY user_id ORDER BY transaction_date) AS lag1, LAG(spend, 2) OVER(PARTITION BY user_id ORDER BY transaction_date) AS lag2 FROM Transaction ) SELECT user_id, transaction_date, spend, lag1, lag2 FROM cte1 WHERE rw = 3 AND spend > lag1 AND spend > lag2;
@santoshingle3977Ай бұрын
Can you please provide data for all the test cases in your videos.