There is table called accounts
containing transaction data with columns account_number
, date
, balance
…
I want to get the balance for each account_number
where the balance<-1000000000 on the last day of each account transaction, and sort the output by balance ASC.
How can I do this?
2
Answers
Use this query, just need to know which format your date.
But assume it
YYYY-MM-DD
query joins the "accounts" table with a subquery to efficiently retrieve the balances where the balance is less than -1,000,000,000 on the last transaction date, sorted by the balance in ascending order.