MYSQL的降序排列_MySQL
程序员文章站
2022-04-28 21:12:27
...
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