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
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
This award recognizes an author who contributes the highest volume of original works or content. Recipients of this award produce extremely valuable content that prioritizes accuracy, relevancy, and professionalism.