The treasury team needs a monthly comparison of total deposits vs total withdrawals. For each month (YYYY-MM), compute total_deposits and total_withdrawals using conditional aggregation. Also compute net_flow (deposits minus withdrawals). Sort by month.
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