Use rollup to calculate grand totals with grouping
I have a stored procedure: ALTER PROCEDURE GetReportData AS BEGIN SELECT LOC.SubCompanyNameVN, LOC.BranchName, COUNT(LOC.BranchCode) as Total, ———– Not Processed Yet SUM (CASE WHEN SS.Status IN (5, 6) THEN 1 ELSE 0 END) AS CountNotProcessedYet, ———– Processing SUM (CASE WHEN SS.Status IN (3) THEN 1 ELSE 0 END) AS CountProcessing FROM Continue Reading