MYSQL的降序排列
今天查詢時需要用到降序排列,老是出錯,仔細檢查SQL語法也沒問題,
後來才知道,原來order by要放在limit的前面。或者說limit要放在最後。
www.2cto.com
[sql]
String sql = "select * from s_dayreport " +
"where userId = "+userId+" " +
"order by taskDate desc " +
"limit "+firstResult+","+maxResults+" ";