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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 With Rollup Question

Author  Topic 

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-03-06 : 13:29:07
I have a nice little view that pivots on the fiscal quarter, everything is good even using the WITH ROLLUP to get summarized data, however, I would like to have it sort so the WITH ROLLUP values appear below the actual data. So instead of getting something like:

Team Year Q1 Q2 Q3 Q4
----------------- ---- ------ ---- ----- ------
Support Services NULL 500.00 0.00 68.00 186.00
Support Services 2001 230.00 0.00 32.00 126.00
Support Services 2002 270.00 0.00 36.00 60.00

I would like to see it like this:

Team Year Q1 Q2 Q3 Q4
----------------- ---- ------ ---- ----- ------
Support Services 2001 230.00 0.00 32.00 126.00
Support Services 2002 270.00 0.00 36.00 60.00
Support Services NULL 500.00 0.00 68.00 186.00

Thanks,
... Onamuji

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-06 : 13:47:06
Add this to your ORDER BY clause:

ORDER BY GROUPING(Year), Year

Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-03-06 : 14:41:48
You rock. :-)

- Onamuji
Go to Top of Page
   

- Advertisement -