Help us help you in the future. Take the time to make some readily consumable data for your posts. Like this...
CREATE TABLE #PretendView
(
[Mismatch Field Name] VARCHAR(10)
,[Count] INT
,Duplicates INT
,Repeats INT
,
)
;
INSERT INTO #PretendView
([Mismatch Field Name], [Count], Duplicates, Repeats)
VALUES ('City' , 30, 0,0)
,('Name' , 54, 2,1)
,('Amount',917,16,2)
,('Date' ,516, 4,1)
;
Using that data, the following will do what you wish even if the MMFN column has a NULL in it.
SELECT [Mismatch Field Name] = CASE
WHEN GROUPING([Mismatch Field Name]) = 0
THEN [Mismatch Field Name]
ELSE 'Total'
END
,[Count] = SUM([Count])
,Duplicates = SUM(Duplicates)
,Repeats = SUM(Repeats)
FROM #PretendView
GROUP BY [Mismatch Field Name] WITH ROLLUP
ORDER BY GROUPING([Mismatch Field Name]), [Mismatch Field Name]
;
That produces the following...
Mismatch Field Name Count Duplicates Repeats
------------------- ----------- ----------- -----------
Amount 917 16 2
City 30 0 0
Date 516 4 1
Name 54 2 1
Total 1517 22 4
(5 row(s) affected)
Please see the following article for more information on the power of GROUP BY and all the crazy groupings you can get out of it.