Groups > Databases > MySQL for ASP.NET > Re: SUM () function




SUM () function

SUM () function
Wed, 5 Mar 2008 04:17:23 +0000
I have 2 tables A and B.

A contains a column "AMOUNT"

B contains a column "ISSUEDAMOUNT" 

I want to get  the difference between total AMOUNT and total ISSUEDAMOUNT.
Post Reply
Re: SUM () function
Wed, 5 Mar 2008 05:09:54 +0000
this should do the job

select Amount - ISSUEDAMOUNT from
(
(Select sum(AMOUNT) from tableA where (your where conditions)) as Amount ,
sum(ISSUEDAMOUNT) as ISSUEDAMOUNT
from tableB 
where (your where conditions)) 
) as Tempdata
Post Reply
Re: SUM () function
Wed, 5 Mar 2008 06:02:06 +0000
This will help you

 select (select sum(AMOUNT) from TableA) - (select sum(ISSUEDAMOUNT) from
TableB) as 'Difference Amount'
Post Reply
Re: SUM () function
Wed, 5 Mar 2008 06:50:16 +0000
Thanks Rajkamalr...........................................................

its working..........:) :) :)
Post Reply
about | contact