Here’s my mysql table:
Table League (userid and lid are primary keys):
*userid* *lid* rank win loss streak score
---------------------------------------------------------
2 1 1 2 0 2 10
2 3 2 1 1 1 5
5 1 2 1 1 1 5
I’m trying to select the users with the top score only once. For example since userid 2 is in league (lid) 1 and 3, only his top score will be selected in the query. So in that case the row with score 10 would be selected since that’s the users top score from both league 1 and 3. The row with lid 3 will not be selected.
So the query results should look like this:
userid lid rank win loss streak score
---------------------------------------------------------
2 1 1 2 0 2 10
5 1 2 1 1 1 5
As you can see userid 2 with lid 3 was not in the result because the score 10 from lid 1 was grater than score 5 from league 3. Any ideas?
1 Answer