DB2分页

  1. 使用rownumber() over()函数产生序列,再where条件限定条数。
select * from (select rownumber() over() as tbid, a.* from SAPHEC.ZBMT301 a) as b where b.tbid<=10;
  1. 查询第10条至第15条的数据
select * from (select rownumber() over() as tbid, a.* from SAPHEC.ZBMT301 a) as b where b.tbid between 10 and 15;
  1. fetch first 10 rows onl取10条数据
SELECT * FROM SAPHEC.ZBMT301 fetch first 10 rows only;

你可能感兴趣的:(DB2分页)