Click here to Skip to main content
14,298,693 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello,

I need help to get the sum of resulting values of these two queries.

i.e
SumValue = TotalBalance + AdditionalFee 


What I have tried:

SELECT Sum(t.Balance) AS TotalBalance
From
(SELECT tblFeePayment.AdmissionNo, [payable] - [paidamount] AS Balance     
  FROM [tblFeePayment])t
  Where t.AdmissionNo = 4

(SELECT sum(FineAmount) AS AdditionalFee From StudentFine WHERE Paid=0  AND AdmissionNo = 4 ) 
Posted
Updated 8-Sep-19 7:24am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You can do it with UNION, see example here:
sql server - TSQL - Sum a union query - Stack Overflow[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100