如何在mysql中使用rownum

时间:2016-09-05 23:34:19

标签: mysql django paging

就我而言,我尝试将此代码用于pa

boardList = DjangoBoard.objects.raw('SELECT Z.* FROM(SELECT X.*, ceil( rownum / %s ) as page FROM ( SELECT ID,SUBJECT,NAME, CREATED_DATE, MAIL,MEMO,HITS \
                                    FROM web_DJANGOBOARD  ORDER BY ID DESC ) X ) Z WHERE page = %s', [rowsPerPage, current_page])

但是,这是甲骨文的代码,不适用于mysql。所以,rownum有错误。我该怎么办?

0 个答案:

没有答案