26 April 2012

How to Use Syntax - With RollUp

WITH ROLLUP –
Menambahkan row sebelum pergantian data dari GROUP BY.
Dengan mensummarize aggregate function yang ada.

-----start-----
SELECT
 SOP_Number,
 Item_Number,
 GROUPING(Item_Number) source,
 sum(Extended_Price)[Extended Price],
 count(Extended_Price)[Count]
 from Sample_With_RollUp
GROUP BY SOP_Number,Item_Number
WITH ROLLUP
-----end-----