'groceries' transaction series: <= 60 min, Mar–Jun 2025
Instructions
For each transaction find the previous transaction of the same account (of any category; ordered by tx_time, ties by id). Output the transactions of the category 'groceries' with tx_time on or after March 1, 2025 and strictly before July 1, 2025 that happened no later than 60 min after the account's previous transaction (inclusive; compare the exact interval, not the rounded value). The first transaction of an account has no previous one and is not output. Columns: id, account_id, tx_time, amount and minutes_since_prev, the number of minutes since the previous transaction, rounded to 1 decimal place. Sort by the exact interval since the previous transaction ascending, then by id 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
accounts.→client_id clients.id - N:1Many-to-one
transactions.→account_id accounts.id
Table data
Select a table in the diagram or list to view its rows.