[英]Pagination in the AS400 SQL
I'm trying to do the pagination for the as400 table which is of version 6 and release 1我正在尝试为版本 6 和版本 1 的 as400 表进行分页
I'm using this query:我正在使用这个查询:
select * from AJSTYLES91.CLIENT
ORDER BY CNUM
LIMIT 2 [OFFSET 2];
but is not working so can any one suggest me the proper query to use please!!!但不工作,所以任何人都可以建议我使用正确的查询!!!
I think declare global temporary table
works in v6r1
.我认为
declare global temporary table
在v6r1
中有效。 You can select all of your rows into a temporary table.您可以将 select 您的所有行放入一个临时表中。
declare global temporary table orders as (
/* open orders */
select a.orhordnum ordnum, a.orhshpnam shipname
from dwhpf30c a
where a.orhcmp = 'N'
order by a.orhshpnam
) with data with replace
then use rrn
on that resulting table to calculate the page number and select on that page.然后在该结果表上使用
rrn
计算页码和该页面上的 select 。
select a.ordnum, a.shipname, rrn(a),
decimal( (rrn(a) -1) / 30,5,0) + 1 pageNum
from qtemp/orders a
where decimal( (rrn(a) -1) / 30,5,0) + 1 = 5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.