For each active account, compute the net change in balance by summing all transaction amounts. Return account id, account_type, current balance, net_transaction_total (sum of all transaction amounts), and the difference. Sort by the difference descending. Limit to 20.
Schema
🔑idINT
🔗customer_idINT
account_typeTEXT
balanceREAL
currencyTEXT
opened_atTEXT
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute