MySql query ORDER BY two columns

You can order by multiple columns in mysql.
The first order take first preference and then second one get next preference in mysql.

Example:

ORDER BY created_date ASC, updated_date DESC

Statement lik:

ORDER BY created_date, updated_date DESC

will sort both columns descending.

If specified each column ASC or DESC, first order will take first preference and then second one get next preference in mysql

By Keenlio, January 24, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


× one = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>