I am trying to create an payment report which lists the sum in each account.
The table is in SQL SERVER 2005 and it has the following table
[Account] [Amount] [Type]
1111 10 C
1111 10 C
1111 15 D
1111 5 D
1112 10 C
1112 15 C
1112 10 D
1112 10 D
I need to create report that will sum the Credit and Debit for each account
Output
1111 0
1112 5
Is there a single SELECT statement that I can use to generate the output? I can do this by creating temp tables but I was wondering if I can do it in a single SELECT statement
1 Answer