I have a table with four columns - InvoiceCreditLineID, SOPOrderReturnLineID, InvoiceCreditQuantity, SOPInvoiceCreditType. The third contains only positive numbers. The fourth contains a 1 for credits and a 2 for debits.
I need to show summed credit quantities minus the summed debit quantities, grouped by SOPOrderReturnLineID.
I tried using a sum in a subselect in the select clause for the credit quantities and another for the debit quantities, but this just shows me the totals for the whole table.
Any idea how I do this?
View Complete Post