select * FROM(SELECT`share`.id, `share`.projectId, `share`.title, `share`.content, `share`.createAt, `share`.clickCount, `share`.report, `share`.likeCount, `share`.favoriteCount, account.nickName, account.avatar, `share`.accountId FROM`share`, account WHERE`share`.accountId = account.id) s LEFT JOIN(SELECT max(share_reply.createAt) AS createTime, share_reply.shareId, account.nickName AS replyNickName, account.id AS replyAccountId FROM share_reply LEFT JOIN account ON account.id = share_reply.accountId GROUP BY share_reply.shareId) sr ON s.id = sr.shareId WHERE s.projectId IN (?)
这个语句直接跑能查询全部记录,可是用分页进行查询就不能查询全部记录了。
Page<Share> sharePage = dao.paginate(i, j, "select *","FROM(SELECT`share`.id, `share`.projectId, `share`.title, `share`.content, `share`.createAt, `share`.clickCount, `share`.report, `share`.likeCount, `share`.favoriteCount, account.nickName, account.avatar, `share`.accountId FROM`share`, account WHERE`share`.accountId = account.id) s LEFT JOIN(SELECT max(share_reply.createAt) AS createTime, share_reply.shareId, account.nickName AS replyNickName, account.id AS replyAccountId FROM share_reply LEFT JOIN account ON account.id = share_reply.accountId GROUP BY share_reply.shareId) sr ON s.id = sr.shareId WHERE s.projectId IN (?)",paraToInt);
请问这个怎么办呢?
如果用jfinal 中的 find查詢,能查出正確的記錄數,8條。但用分頁查詢,居然只有3條。
项目:JFinal
dao.paginate(i , j , true, ...);