Aamir  Halim Aamir Halim - 1 month ago 6
MySQL Question

More than 2 ORDER BY in a single query?

I am trying to figure out if there can be more than two ORDER BY's in a single query, instead of having multiple queries. For some reason every time I include a third 'ORDER BY' it does not work on any column I choose.

Here is my code (Single Query For Each):

First Code Image

This is what I am trying to do (This includes a Customer Order By):

What I am Trying To Do

Any help would be highly appreciated! Thank you !

Answer
ORDER BY CASE WHEN .... END ASC, Col1,Col2 ....

Separate multiple columns by comma instead of adding ORDER BY for each column