For each transaction type, find the single transaction with the highest amount. Use a CTE with ROW_NUMBER to rank transactions within each type. Return the type, transaction id, account_id, amount, and transaction_date. Sort by amount descending.
Schema
🔑idINT
🔗account_idINT
transaction_dateTEXT
typeTEXT
amountREAL
balance_afterREAL
descriptionTEXT
reference_numberTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute