users table:
id-user-other columns
scores table:
id-user_id-score-other columns
They’re are more than one rows for each user, but there’s only two scores you can have. (0 or 1, == win or loss). So I want to output all the users ordered by the number of wins, and all the users ordered by the numbers of losses.
I know how to do this by looping through each user, but I was wondering how to do it with one query. Any help is appreciated!
if you want two outputs you need two queries
You then do another query for the losses.
Essentially this is the same as Adams response, but his response will give you a list of users ordered by wins, then ordered by losses.
To get losses, just change the s.score=1 to s.score = 0