Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

how to find max amount Expand / Collapse
Author
Message
Posted Friday, August 27, 2010 11:44 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, November 23, 2016 1:29 PM
Points: 100, Visits: 634
Same result as TakeITeasy, but using a derived table.

SELECT *
FROM (
SELECT ROW_NUMBER() OVER (PARTITION BY id ORDER BY adate desc) AS ROW,
id,
amount,
adate
FROM @t
) T
WHERE T.ROW = 1
Post #976622
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse