?
Solved

SQL Server 2008 -  ROLL UP function

Posted on 2011-05-05
2
Medium Priority
?
520 Views
Last Modified: 2012-06-21
Hi,

I recently stumbled across the ROLL UP function in SQL Server, apparently there are two synatx of it where one is

1) GROUP BY fieldname1,fieldname2 WITH ROLL UP

2) GROUP BY ROLL UP (fieldname1, fieldname2)

I was wondering if there's a difference to the two syntax? I'm returning the same results with either. Thank you.
0
Comment
Question by:Shino_skay
2 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 1000 total points
ID: 35700270
Both are same but "WITH ROLLUP" is Non-ISO Compliant Syntax.
Please read this: http://technet.microsoft.com/en-us/library/ms177673.aspx

Transact-SQL 

Non-ISO-Compliant Syntax
[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
    [ WITH { CUBE | ROLLUP } ] 
]

Open in new window

0
 
LVL 21

Assisted Solution

by:Alpesh Patel
Alpesh Patel earned 1000 total points
ID: 35704410
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question