I have the following 3 rows in my database table
ID resID userID source event pos award
3239 23796 8365 18 120 0 qualified
3670 23796 8365 18 120 1 Finalist
3671 23796 8365 18 120 0 first
Now the award column is enum ( “first”,”Finalist”,”qualified” )
I need to get the best of the award from the 3 rows i.e
ID resID userID source event pos award
3671 23796 8365 18 120 0 first
I tried the following query
SELECT * from sometable
WHERE userID = 8365
GROUP BY userID
having min(award+0)
But it is not working . Could some one give some pointers
Another way: