RollUp

Saranya Boopathi
Posted by Saranya Boopathi under Sql Server category on | Points: 40 | Views : 944
The ROLLUP operator is useful in generating reports that contain subtotals and totals.

select  Lnno = CASE WHEN GROUPING(BOOKNO) = 1 THEN 'Total:'
ELSE BOOKNO END
,[Count] = COUNT(BOOKNO) from Book_deatils
where BOOKNO in ('NRTWANM','NRTWCL','NRTWCT0')
GROUP BY BOOKNO WITH ROLLUP

Comments or Responses

Login to post response