DB2分页查询SQL
select * from
(select row_number() over() as rown,tpag.* from(SELECT int(COALESCE(列名1,0)),COALESCE(列名2,chr(0)),COALESCE(列名3,chr(0)),COALESCE(列名4,0), COALESCE(列名5,0),COALESCE(列名6,0)
FROM 表名 where 列名7=条件 and 列名8=1 and 列名9=0 order by 列名10)
(select row_number() over() as rown,tpag.* from(SELECT int(COALESCE(列名1,0)),COALESCE(列名2,chr(0)),COALESCE(列名3,chr(0)),COALESCE(列名4,0), COALESCE(列名5,0),COALESCE(列名6,0)
FROM 表名 where 列名7=条件 and 列名8=1 and 列名9=0 order by 列名10)
tpag fetch first 20000 rows only) tt where tt.rown between 1 and 20;
fetch first 20000 rows only防止过多占用资源。