Click here to Skip to main content
14,971,553 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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

SumValue = TotalBalance + AdditionalFee 

What I have tried:

SELECT Sum(t.Balance) AS TotalBalance
(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 ) 
Updated 8-Sep-19 7:24am

1 solution

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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900