Mysql sort

1. Sort order by, the ORDER BYclause allows to sort the result set on a single column or multiple columns. Sorts the result set of different columns in ascending or descending order.

2. Syntax:

SELECT column1, column2,... FROM tbl ORDER BY column1 [ASC|DESC], column2 [ASC|DESC],...

ASCFor ascending order, DESCfor descending order. By default, if you do not specify ASCor explicitly DESC, the ORDER BYclause sorts the result set in ascending order.

3. In addition, the ORDER BYclause allows to FIELD()define your own custom sort order for the values ​​in the column using functions. Functions can be used FIELD()to map these values ​​to a list of values, and to sort by numbers

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324552411&siteId=291194637