Home  >  Article  >  Database  >  mysql多条件排序_MySQL

mysql多条件排序_MySQL

WBOY
WBOYOriginal
2016-06-01 13:29:311531browse

bitsCN.com

mysql多条件排序

 

在数据库查询时,常常需要排序,而有时排序条件可能有多个.

 

    如数据库:    a      b          1      103        1      101    2      201     2      203    1      102    2      202排序后:    a      b          1      103        1      102    1      101     2      203    2      202    2      201

 

 

语句: 

 SELECT A.a , A.b FROM TABLE A ORDER BY A.a  ASC , A.b DESC

 

 

其中ASC连接多条排序,且与后一条查询之间有逗号隔开!

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn