SQL order by multiple fields

SQL order by multiple fields

Last updated:

You can specify multiple order by parameters in a SQL query:

select p.* 
from persons p
order by p.birth_date asc,p.name asc

That would sort the records first by birth_date and, if two records have the same birth_date, they get ordered by name too.

Dialogue & Discussion