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.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.