SQL Syntax Needed for Combining record amounnts
Posted on 2011-03-15
I have a situtation where I need to combine the invidual records into one while also keeping records. This is for an accounting program and here is an example.
Let's say we have these four records:
So the total document amount is $500 made up of 150+150+150+50.
What I am trying to accomplish with one sql statement is to list the four records plus a fifth record which would look like :
1001,500,0,500 where on this record the credit amount in the sum of the four debit amounts. It is the creation of the fifth record that is casing trouble. The common field is the TrxNumb field. The four records actually exist in the table and the fifth record is a virtual record. I need the fifth record to complete the dataset. Can this be accomplished in one SQL statement or perhaps I need to create another table from this data and use that table?