I think ROW_NUMBER() would actually be slower for this. (GROUP BY with MAX is quicker I think).You could try:DECLARE @report_history TABLE ( [user_name] VARCHAR(50) , [report_name] VARCHAR(50) , [report_run_date] DATETIME )INSERT @report_history ([user_name], [report_name], [report_run_date]) SELECT 'bRubble', 'Foot Breakage Report', '20090101'UNION SELECT 'fFlintstone', 'Foot Breakage Report', '20090101'UNION SELECT 'wFlintstone', 'Foot Breakage Report', '20081231'UNION SELECT 'bamBAM', 'Club Breakage Report', '20090101'SELECT [user_name] , [report_name] , [report_run_date]FROM ( SELECT [user_name] , [report_name] , [report_run_date] , ROW_NUMBER() OVER(PARTITION BY [report_name] ORDER BY [report_run_date] DESC, [user_name]) AS [POS] FROM @report_history ) tWHERE t.[pos] = 1
And see if that is slower or faster.NB -- the sql I posted may not give you the same results as your current query which would actually have brought back everyone from my example table except for wFlintstone).You are trying to pull back:For each report, the last time it was ran and who ran it?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION