Hello! I keep getting an error when trying to create this query, and I'm not sure why.
Here is the error that is displayed when the 2nd column (c.status) is included in the Select statement:
ERROR: column "c.status" must appear in the GROUP BY clause or be used in an aggregate function Position: 39
select c.name as "Case Name", c.status as "Status", sum(tt.amount) as "Balance" from cases_case as c join trustaccounts_casetrust as ct on c.id = ct.case_id join trustaccounts_trusttransaction as tt on ct.id = tt.case_trust_id where ct.case_id isnull = false group by c.name order by "Balance" desc
Any tips/ advice?