order by
When using + multiple columns in SQL statements , you need to pay attention to:
- When sorting, it is first sorted according
order by
to the first one , and then sorted according to the second one, and so on.col
col
- When sorting, if you don't specify
ASC
whether orDESC
how, the default isASC
. ASC
andDESC
only affect the first one in front of themcol
,col
not the others. as follows:
order by col1 Desc,col2 此时先col1降序排序,然后col2升序排列。
order by col1 ,col2 Desc 此时先col1升序排序,然后col2降序排列。