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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2007-01-04 : 17:47:27
|
| I have 6 select statement combined with union between each of them.Is it possible to group by data using first column statuscode.or can i load all the 6 select statements data into one cursor and do a groupby for the first column which is statuscode.All of the 6 select statements are calling data from 6 diferent tables only the first column name is common.Thank you very much for the information. |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-01-04 : 17:53:00
|
Put the union into a derived table, and do the grouping in the main query.select MyColfrom ( select Mycol from table1 union all select Mycol from table2 union all select Mycol from table3 ) agroup by Mycol CODO ERGO SUM |
 |
|
|
|
|
|