ROLLUP

Saranya Boopathi
Posted by Saranya Boopathi under Sql Server category on | Points: 40 | Views : 1417
ROLLUP:
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_details
where BOOKNO in ('NRTWANM','NRTWCL','NRTWCT0')
GROUP BY BOOKNO WITH ROLLUP

Comments or Responses

Login to post response