Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Multiple grouping sets - placeholder?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

11 Posts

Posted - 02/22/2013 :  15:45:28  Show Profile  Reply with Quote

Hello all,

Thanks for helping out!

The following query will use placeholders (NULL) if an element is not part of the grouping set.

From what I understand is that columns can be NULL or have an value.
I only 'see' two possible values:

1) a shipping city is filled in, for instance with the value 'xxx'
2) nothing is filled in, thus it's NULL, unknown.
3) what is the third??

What does it mean "an element is not part of the grouping set" ?

SELECT shipcountry, shipregion, shipcity, COUNT(*) AS numorders
FROM Sales.Orders
GROUP BY ROLLUP( shipcountry, shipregion, shipcity );

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 02/23/2013 :  02:13:01  Show Profile  Reply with Quote
The third is total rows for one of category ie for ex. total for particular country or region or city. It will have NULL for the other columns


SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000