首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

mysql 排序有关问题

2011-12-18 
mysql 排序问题select*fromnewswherecategoryid 1 orderbyIDdescjava.sql.SQLException:Youhaveanerrorin

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最好 每个词后加一个空格,不然很容易写出错的语句

热点排行