当前位置:Gxlcms > mysql > MYSQL的降序排列_MySQL

MYSQL的降序排列_MySQL

时间:2021-07-01 10:21:17 帮助过:174人阅读

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

人气教程排行