Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dhani
Posting Yak Master
132 Posts |
Posted - 2008-09-18 : 09:40:02
|
| hello all can any one please tell me how to do below wayi have 2 tables (ex table1, table2)Query1:select sum(col1) from table1Query2:select sum(col2) from table2how can i show addition of above two queries (i.e., query1 result + query2 result)thanks in advanceDhani |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-18 : 09:50:23
|
| select sum(summation) as summation from(select sum(col1) as summation from table1union allselect sum(col2) from table2) as tMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-18 : 09:51:47
|
| orselect (select sum(col1) as summation from table1)+(select sum(col2) from table2)MadhivananFailing to plan is Planning to fail |
 |
|
|
dhani
Posting Yak Master
132 Posts |
Posted - 2008-09-18 : 10:27:17
|
| Madhivanan thank you very muchi got iti appreciate, for your speedy answerdhani |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-18 : 11:37:02
|
quote: Originally posted by dhani Madhivanan thank you very muchi got iti appreciate, for your speedy answerdhani
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|