When using union all, how can I order result set of how it gets displayed? For example
Right now it returned
Descripton SalesType Customercode Jan Feb Mar Apr May Jun Jul Aug Oct Nov Dec Total
Sale Direct 1 $ $ $
Manager Resell 1 $ $ $
Inter Extr 1 $ $ $
Exter EU 1 $ $ $
I want to return like or any order of result set
Descripton SalesType Customercode Jan Feb Mar Apr May Jun Jul Aug Oct Nov Dec Total
Inter Extr 1 $ $ $
Exter EU 1 $ $ $
Manager Resell 1 $ $ $
Sale Direct 1 $ $ $
Table sample
column names
Descripton SalesType Customercode Jan Feb Mar Apr May Jun Jul Aug Oct Nov Dec Total
select *from
(
select * from #temp_table1
union all
select * from #temp_table2
union all
select * from #temp_table3
union all
select * from #temp_table4
a group by Descripton,SalesType,Customercode,Jan,Feb ,Mar Apr,May,Jun,Jul,Aug,Oct,Nov,Dec,Total
Thank you very much. This is exactly what I need.