Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get total of a column which is sum from other tow colunms

Status
Not open for further replies.

kate8

Programmer
Feb 14, 2001
184
US
Hi All,

I need a total amounts from a column which is also sum of other columns. How can I do it?

select sum(coalesce(payment1,payment2)) payment
from mytable1 t1
left join mytabel2 t2 on ti.id1=t2.id1
where ...
group by ..

Now I need total of payment, how can I do it?
Thank you so much for any helps!!!
 
Hi imex,

Thank you for the information!!
I created a table variable and insert all select into it, then select from the table variable and sum the field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top