G12Consult
Programmer
I have the following view:
Which produces
DR 1285000.00
CR 275000.00
How would I add another row to the query which will substract CR from DR so I end up with:
DR 1285000.00
CR 275000.00
Total 1010000.00
Code:
SELECT TOP (100) PERCENT GBL_ADMIN.dbo.ASSET_TYPES.ACCOUNTING_ENTITY, SUM(dbo.ASSET_INFO_DETAILS.VALUE) AS TOTAL_VALUE
FROM dbo.OWNERS
INNER JOIN dbo.ASSET_OWNERSHIP ON dbo.OWNERS.OWNER_ID = dbo.ASSET_OWNERSHIP.OWNER_ID
INNER JOIN dbo.ASSETS ON dbo.ASSET_OWNERSHIP.ASSET_ID = dbo.ASSETS.ASSET_ID
INNER JOIN GBL_ADMIN.dbo.ASSET_TYPES ON dbo.ASSETS.ASSET_TYPE_ID = GBL_ADMIN.dbo.ASSET_TYPES.ASSET_TYPE_ID
INNER JOIN dbo.ASSET_INFO_DETAILS ON dbo.ASSETS.ASSET_ID = dbo.ASSET_INFO_DETAILS.ASSET_ID
WHERE (dbo.ASSETS.INC_NET_WORTH = 1)
GROUP BY GBL_ADMIN.dbo.ASSET_TYPES.ACCOUNTING_ENTITY, dbo.OWNERS.USER_ID
ORDER BY GBL_ADMIN.dbo.ASSET_TYPES.ACCOUNTING_ENTITY DESC]
Which produces
DR 1285000.00
CR 275000.00
How would I add another row to the query which will substract CR from DR so I end up with:
DR 1285000.00
CR 275000.00
Total 1010000.00