Db2 paging SQL syntax int startPage = 1 // start page int endPage; // end page int pageSize = 5; // page size int pageNumber = 1 // request page startPage = (pageNumber-1) * pageSize + 1 endPage = (startPage + pageSize); select * from (select Field 1, Field 2, Field 3, field 4, Field 5, rownumber ()
Over (order by sorting field asc) as rowid from Table Name) as a where a. rowid
> = StartPage AND a. rowid // The following SQL statement indicates that 5 data records are retrieved from 1 to 5 select * from (select dslsid, zzjtpd, frmc, frlx, mc, frzs, fddbrxm, clrq, frzch, and nsglm,
Swdjrq, bgbs, bgcz, bgrq, swdjjtpd, orgdeptname, nssbh, rownumber ()
Over (order by dslsid asc) as rowid from FR_V_DSLS) as
Where a. rowid BETWEEN 1 AND 6 sorry, I made a low-level error. The preceding SQL statement is incorrect because
I remember that between and contains the former and does not contain the latter. The experiment shows that,
Both between and. Therefore, the preceding statement should be changed to select * from (select dslsid, zzjtpd, frmc, frlx, mc, frzs,
Fddbrxm, clrq, frzch, nsglm, swdjrq,
Bgbs, bgcz, bgrq, swdjjtpd, orgdeptname, nssbh, rownumber ()
Over (order by dslsid asc) as rowid from FR_V_DSLS)
A where a. rowid> = 1 AND a. rowid <6 keep the above statement deeper.