SQL语句:COUNT_SQL="select count(*) from costlog_tabl";
....
prst=conn.prepareStatement(COUNT_SQL);
rest=prst.executeQuery();
我本来是打算统计数据库中有多少条记录的,现在这个rest结果集怎么得到到我的统计,我知道貌似可以用rest.next老判断来设置一个变量来++实现,除了这个怎么实现??????????SQL数据库RESTselect

解决方案 »

  1.   

    还有我这:
    PAGECOSTLOG_SQL="select * from costlog_tabl LIMIT ? where not in(select * from costlog_tabl LIMIT ?)";我是打算做翻页处理,但是总是提示这个语句有错,com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'not in(select * from costlog_tabl LIMIT 9)' at line 1
    但是我感觉没错啊。
      

  2.   

    int pageSize=9;
    prst=conn.prepareStatement(PAGECOSTLOG_SQL);
    prst.setInt(1, pageSize);
    prst.setInt(2, pageSize*(pageNow-1));
    rest=prst.executeQuery();
    ...