Home Forums SQL Server 2008 SQL Server Newbies SQL find maximum of table generated with select RE: SQL find maximum of table generated with select
sqlnaive
SSCoach
Points: 17437
More actions
November 23, 2012 at 10:53 pm
#1561957
Will this help:
SELECT c1
FROM(SELECT c1, SUM(c2) AS 'Adding',(ROW_NUMBER() OVER (ORDER BY SUM(c2) DESC)) AS 'Row'
FROM Table1 t1
GROUP BY c1) a
WHERE Row = 1