I am trying to summarize my information. I have the following table
Date
Amount
D/C (for Debit or Credit)
The amounts that are Debits need to be positive and the one that are Credits need to be negative. So I do the following
SELECT
Date
CASE WHEN D/C=D THEN Sum (Amount)
ELSE -Sum(Amount) as Amount
GROUP BY Date, D/C
The problem with this approach is that I get 2 rows for each date, one for Debits and one for Credits. I would like to only have one line which would be the summation of Debits and Credits (credits being negative).
Please advise how I would go about it. Thank you.