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 |
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2014-07-07 : 22:01:34
|
i did a union to query out the count on baggage and customer.the first 2 row are from first query, the 3rd and 4th row are from second query.category status country baggage adult childadult board AUS 100KG 0 0child board AUS 101KG 0 0 board 90 9 missing 18 1 how can i sum all together? i tried sum but it still come out the same. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2014-07-08 : 00:05:29
|
Here's one way - using a derived tableselect <cols>, sum(<otherCol>)from ( <query1> union all <query2> ) as dgroup by <cols> Be One with the OptimizerTG |
 |
|
|
|
|