Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Add Total to the query RE: Add Total to the query
David Burrows
SSC Guru
Points: 65138
More actions
December 18, 2013 at 6:45 am
#1674405
SELECT COALESCE(GroupName,'Total') AS [GroupName],SUM(NumberOfCases) AS [NumberOfCases]
FROM #TempTable
GROUP BY GroupName WITH ROLLUP
ORDER BY GROUPING(GroupName) ASC
Far away is close at hand in the images of elsewhere.Anon.