Aamir  Halim Aamir Halim - 1 year ago 64
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 Source
ORDER BY CASE WHEN .... END ASC, Col1,Col2 ....

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download