SQL query problem
July 17, 2009 7:35 AM Subscribe
I need to write a query that will return the largest value of one column for each unique value in another column. Example included.
Given this table:
NAME SALARY
Smith 5
Smith 22
Adam 55
Jones 12
Jones 10
Smith 21
Smith 4
how would you return one row per NAME with the largest value of SALARY for that name:
NAME SALARY
Adam 55
Jones 12
Smith 22
Given this table:
NAME SALARY
Smith 5
Smith 22
Adam 55
Jones 12
Jones 10
Smith 21
Smith 4
how would you return one row per NAME with the largest value of SALARY for that name:
NAME SALARY
Adam 55
Jones 12
Smith 22
This thread is closed to new comments.
posted by jacobm at 7:41 AM on July 17, 2009 [2 favorites]