Split displayed accounts by on- or off-budget

This commit is contained in:
2021-12-07 21:07:09 +00:00
parent 04fd687324
commit f4ddf12214
4 changed files with 41 additions and 14 deletions

View File

@ -14,7 +14,7 @@ WHERE accounts.budget_id = $1
ORDER BY accounts.name;
-- name: GetAccountsWithBalance :many
SELECT accounts.id, accounts.name, SUM(transactions.amount)::decimal(12,2) as balance
SELECT accounts.id, accounts.name, accounts.on_budget, SUM(transactions.amount)::decimal(12,2) as balance
FROM accounts
LEFT JOIN transactions ON transactions.account_id = accounts.id
WHERE accounts.budget_id = $1