SQL Server Distinct Question

Posted by RPS on Stack Overflow See other posts from Stack Overflow or by RPS
Published on 2010-05-26T18:04:01Z Indexed on 2010/05/26 18:21 UTC
Read the original article Hit count: 372

Filed under:
|
|
|

I need to be able to select only the first row for each name that has the greatest value.

I have a table with the following:

id  name  value

0   JOHN  123
1   STEVE 125
2   JOHN  127
3   JOHN  126

So I am looking to return:

id  name  value

1   STEVE 125
2   JOHN  127

Any idea on the MSSQL Syntax on how to perform this operation?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server