SELECT F.Account,
SUM(NET_PAY_AMOUNT) + SUM(OTHER_INCOME_AMOUNT) Income,
SUM(EXP_CHILD_CARE_AMOUNT) + SUM(EXP_FOOD_AMOUNT) +
SUM(EXP_LIFE_INSURANCE_AMOUNT) + SUM(EXP_TRANSPORTATION_AMOUNT) +
SUM(EXP_TUITION_AMOUNT) + SUM(EXP_USER_2_AMOUNT) +
SUM(EXP_USER_3_AMOUNT) + SUM(EXP_UTILITIES_AMOUNT) Expenses
FROM finances F
INNER JOIN account a ON f.Account = a.Account
WHERE a.balance > 0
GROUP BY F.Account
|