今天写新闻管理模块,需要在页面显示最近10条新闻!
SQL语句如下:
String sql="select top 10 * from news where type='主页' order by news_id DESC ";
ResultSet rs= newsBean.executeQuery(sql);
测试的时候发现出错!ERROR 1064 (42000): 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 'from news where type='主页' order by news_id DESC
select top10 * from news wher' at line 1 在SQL 语句中 把TOP 10 去掉 直接select * from ..... 就好使 晕死我了!!!
请问到底是什么错误啊!!我用的是JSP+MYSQL+TOMCAT5.0 !!!!!!
SQL语句如下:
String sql="select top 10 * from news where type='主页' order by news_id DESC ";
ResultSet rs= newsBean.executeQuery(sql);
测试的时候发现出错!ERROR 1064 (42000): 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 'from news where type='主页' order by news_id DESC
select top10 * from news wher' at line 1 在SQL 语句中 把TOP 10 去掉 直接select * from ..... 就好使 晕死我了!!!
请问到底是什么错误啊!!我用的是JSP+MYSQL+TOMCAT5.0 !!!!!!
解决方案 »
- 请问我建的mysql外键错在哪里了啊?
- 请问,我用的mysql 触发器中,为什么不能用 begine ... end
- 请问:MySql的数据怎样导入到SqlServer中呢?
- mysql 5.0.21-log 如何选择存储引擎?
- 好久没来,论坛现在还火热啊(散分)
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket
- 如何用mysql 的c api 对jpg文件的读写?
- MYSQL中文显示乱码
- 乞求一sql写法
- mysql Server has gone away问题,在线等高手
- 关于自动编号的问题?
- 谁知道如何在本地用mysql管理工具,远程访问服务器的mysql 数据库。
试用 下:
select top 10 from news where type='主页' order by news_id DE