Db的分页方法是如何执行的?

愤怒的jfinal 发布于 2015/11/25 11:30
阅读 195
收藏 0

String sql = " active_comment  order by id desc";int startPage = 1,count=5;

Page<Record> dataPage = Db.paginate(startPage, count, "SET @num = 0; select @num :=@num+1 as numid,*", " from " + sql);

我想添加一个伪序列号,但是报错了:

com.jfinal.plugin.activerecord.ActiveRecordException: com.mysql.jdbc.exceptions.jdbc4.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 'select @num :=@num+1 as numid,*  from  active_comment ' at line 1

加载中
0
iSea
iSea
这个sql是什么鬼?
愤怒的jfinal
愤怒的jfinal
就是创建一个伪序号;目前找到其他方法来解决分页刷新问题了。
返回顶部
顶部