Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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 Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 11:18 AM
Points: 97, Visits: 543
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