Order by on multiple column?

hey all,
i got mysql query. i am using order by first_nameASC, but now i wan’t another column with got values of pass or fail to to sorted too e.g pass comes on top and fail comes below it. can i apply order by on multiple column or is there any order way around?

Yes, you can do that:

SELECT name, score FROM results ORDER BY pass_or_fail DESC, first_name ASC;

This is assuming pass_or_fail is a boolean field indicating 1 for a pass, 0 for a fail.

its datatype is double not bool

‘pass’ and ‘fail’ seem strings to me :slight_smile:

What value in your double column indicates ‘pass’, and what value indicates ‘fail’?

Actually i have two option (pass,fail was a dummy case), either its disqualified or amount of money. data type is double

Disqualified? What value is that? NULL?


Ok, then Immerse’s solution will work just fine.


To sort in reverse order, add the DESC (descending) keyword to the name of the column in the ORDER BY clause that you are sorting by. The default is ascending order; this can be specified explicitly using the ASC keyword.

It worked,

What does that mean? Is it not sorting the right way?

is it possible that the query’s 0 value is shown as Disqualified on fronted? or am i looking at some wrong column

You lost me here. Is this something you would like, or is it something that is already happening?