Usman ali
Usman ali

Reputation: 13

order by multiple columns, which will sort first?

I mean we can order by a column through multiple columns than i have question in mind which column will order by customer first

SELECT * FROM Customers
ORDER BY Country ASC, CustomerName DESC,CustomerEmail;

Upvotes: 0

Views: 403

Answers (1)

CodeBeginner
CodeBeginner

Reputation: 329

The way MySQL sorting works is like reading from left to right.

A query like yours means sorting the data by country in ascending order, then by customer name in descending order then by customer email in ascending order (the default when you specify nothing is ascending)

Upvotes: 1

Related Questions