SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Last Transaction of Each Day

Unsolved

Google Pay's reconciliation job needs the closing transaction for every day. The last transaction of a day is the one with the latest created_at on that calendar date. If two transactions share the exact same latest timestamp, the one with the higher transaction_id is treated as last. A transaction at exactly midnight belongs to the new day. Write an SQL query that returns transaction_date, transaction_id and amount for the last transaction of each day. Order the results by transaction_date ascending.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Google

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM bank_transactions
Full source dataset
9 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine