Home > Database > Mysql Tutorial > body text

mysql多条件排序_MySQL

WBOY
Release: 2016-06-01 13:29:31
Original
1530 people have browsed it

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
Copy after login

语句:

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

 

 

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

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!