SQL Server ROLLUP feature

Posts   
 
    
kievBug
User
Posts: 105
Joined: 09-Jan-2009
# Posted on: 04-Feb-2011 03:58:30   

Hi guys,

Is there any way to use ROLLUP feature of the group by clause available in SQL 2005? if not, is there anything I can do to add it?

Basically I need to execute this query:

SELECT f.Category, g.Supplier, COUNT(*) FROM .... WHERE ... GROUP BY f.Category, g.Supplier WITH ROLLUP

Thanks, Anton

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 04-Feb-2011 07:51:07   

You will need to derive your own class from GroupByCollection, and override ToQueryText. There you should call the base class method, and then append WITH ROLLUP to the returned string.