Home >Database >Mysql Tutorial >MYSQL的降序排列_MySQL

MYSQL的降序排列_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:36:272291browse

bitsCN.com


MYSQL的降序排列

 

今天查询时需要用到降序排列,老是出错,仔细检查SQL语法也没问题,

后来才知道,原来order by要放在limit的前面。或者说limit要放在最后。

[sql] 

String sql = "select * from s_dayreport " +  

                    "where userId = "+userId+" " +  

                            "order by taskDate desc " +  

                            "limit "+firstResult+","+maxResults+" ";  

 

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