日期:2014-05-18  浏览次数:20611 次

mysql 排序问题
select   *   from   news   where   categoryid= '1 'order   by   ID   desc

java.sql.SQLException:   You   have   an   error   in   your   SQL   syntax;   check   the   manual   that   corresponds   to   your   MySQL   server   version   for   the   right   syntax   to   use   near   'by   ID   desc '   at   line   1

我按这排序,结果是出来了,但是tomcat报上面的错误。


写降序是怎么写的

------解决方案--------------------
升级jdbc的版本,你用的是什么版本的?

------解决方案--------------------
categoryid= '1 'order

中间少了一个空格!
categoryid= '1 ' order
------解决方案--------------------
写sql最好 每个词后加一个空格,不然很容易写出错的语句