Last purchase per day: KZ, 14 d from February 10, 2025
Instructions
Consider the purchases (purchases) of users with country = 'KZ'. For each day from February 10, 2025 to February 23, 2025 inclusive (14 days), output day (type date), purchases_cnt (the number of such purchases on that day, by purchased_at) and last_amount (the amount of the latest such purchase made no later than the end of that day, including before the start of the period; for equal purchased_at, the one with the greatest id). If there were no purchases on a day, last_amount is carried over from the previous day. Sort by day ascending.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
events.→user_id users.id - N:1Many-to-one
purchases.→user_id users.id
Table data
Select a table in the diagram or list to view its rows.