Hello,
I have a table as such:
NAME RANK WIN_PERCENT DRAW_PERCENT
The table can have the same people in it multipe times, such as:
NAME LEVEL WIN_PERCENT DRAW_PERCENT
Bob 4 80% 4%
Bob 5 90% 5%
Bob 8 60% 3%
What I would like to do is return only the row in which Bob's Level is the Highest (MAX).
I wrote an aggregate query as such:
SELECT NAME, MAX(LEVEL) AS MAX_LEVEL, WIN_PERCENT, DRAW_PERCENT
FROM MYTable
GROUP BY NAME, WIN_PERCENT, DRAW_PERCENT
The problem is, as you'd expect, this query returns all rows, since I am grouping by WIN_PERCENT and DRAW_PERCENT as well.
Any ideas on what query to use to just return the row with the highest (MAX) LEVEL? i.e.
NAME LEVEL WIN_PERCENT DRAW_PERCENT
Bob 8 60% 3%
Thanks,
Scott
I have a table as such:
NAME RANK WIN_PERCENT DRAW_PERCENT
The table can have the same people in it multipe times, such as:
NAME LEVEL WIN_PERCENT DRAW_PERCENT
Bob 4 80% 4%
Bob 5 90% 5%
Bob 8 60% 3%
What I would like to do is return only the row in which Bob's Level is the Highest (MAX).
I wrote an aggregate query as such:
SELECT NAME, MAX(LEVEL) AS MAX_LEVEL, WIN_PERCENT, DRAW_PERCENT
FROM MYTable
GROUP BY NAME, WIN_PERCENT, DRAW_PERCENT
The problem is, as you'd expect, this query returns all rows, since I am grouping by WIN_PERCENT and DRAW_PERCENT as well.
Any ideas on what query to use to just return the row with the highest (MAX) LEVEL? i.e.
NAME LEVEL WIN_PERCENT DRAW_PERCENT
Bob 8 60% 3%
Thanks,
Scott