I want to get the User with the highest points in SQL. I have this Table:
userId | points |
---|---|
1 | 1 |
2 | 0 |
3 | 4 |
1 | 1 |
3 | 2 |
2 | 5 |
Now, I want to get the userId where the points are highest? In this example it where user 3, but how I can do this automatically is SQL?
I think I have a solution for you please check the code below=>
THIS ss for MYSQL 8.0
NOTE: Check output in db-fiddle.