So, I am two groups tblTenant.ID tblTransaction.TenantID
There are two fields in tblTransactions that I want to manipulate, AmountCharged and AmountPaid. How can I sum both fields and subtract them for each group? IE, each Tenant will have all of its amounts. Summed amounts, and then the total amount is summed and deducted.
For example, SQL:
SELECT SUM(tblTransactions.AmountCharged) - SUM(tblTransactions.AmountPaid) FROM tblTransactions
Where tblTrascactions.TenantID = x
Where "x" is the group tenant identifier.
source
share