Skip to main content

Posts

Showing posts from May, 2010

SQL SERVER – Introduction of Rollup clause using SUM and GROUP BY clause

SQL SERVER – Introduction of Rollup  clause using SUM  and GROUP BY clause. Hell everyone, I am going to share the basic understanding of  Rollup  clause using SUM and GROUP BY clauses in SQL Server. The  Rollup  clause is used to handle the aggregate operation on multiple levels in hierarchy. A  Rollup   operation can calculate the equivalent of an OLAP dimension or hierarchy. The Query for the same to understand in detail how is work. --CREATE TEMP TABLE FOR TESTING ROLLUP CLAUSE CREATE TABLE #POPULATIONS (             ID INT IDENTITY ( 1 , 1 ),             COUNTRYNAME NVARCHAR ( 255 ),             STATENAME NVARCHAR ( 255 ),             CITYNAME NVARCHAR ( 255 ),             POPULATIONS BIGINT ,             CREATEDDATE DATETIME ) GO --INSERT QUERY FOR INSERT ROWS INSERT INTO #POPULATIONS VALUES ( 'India' , 'U.P.' , 'East U.P.' , 4.1 , GETDATE ()) INSERT INTO #POPULATIONS VALUES ( 'India