Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

order by ..PIVOT SQL Server

$
0
0

Hi

I have a pivot like this

Select

CalendarYear,CalendarMonth,


 


   

count([ID]) asNumberOfOrders

  

     

 

FROM[Database].[dbo].[DataTable]

PIVOT


(


  

SUM(NumberOfOrders)FORCalendarMonthIN([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])


)ASpv1

I wish to order by the CalendarYear, CalendarMonth, but cannot do this because I cannot place an order by before the pivot. How can I do this please

please help



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>