SQL Server 22005: Top 1 * for a unique column?

Posted by Echilon on Server Fault See other posts from Server Fault or by Echilon
Published on 2010-05-15T10:23:40Z Indexed on 2010/05/15 10:35 UTC
Read the original article Hit count: 230

Filed under:
|
|

I have data in a table (below), and I need to select the most recent update from each user. Here the data has been sorted by date, so the 'SomeData' column of the most recent unique value of each user. Top 1 SomeData isn't going to work because it will only return for one user. Is this even possible using only SQL?

Date        SomeData    User    ...
8/5/2010    2.2     UserC
4/5/2010    1.1     UserA
3/5/2010    9.4     UserB
1/5/2010    3.7     UserA
1/5/2010    6.1     UserB

© Server Fault or respective owner

Related posts about sql

Related posts about sql-server-2005