实现分页技术 OracleSQL ServerDB2MySQLSQL
程序员文章站
2022-07-13 08:14:45
...
1.Oracle:
select * from ( select row_.*, rownum rownum_ from ( query_SQL ) row_ where rownum =< max) where rownum_ >= min
2.SQL Server:
select top @pagesize * from tablename where id not in
(select top @pagesize*(@page-1) id
from tablename order by id) order by id
3.MySQL
select * from tablename limit position, counter
4.DB2
select * from (select *,rownumber() as ROW_NEXT from tablename) where ROW_NEXT between min and max
select * from ( select row_.*, rownum rownum_ from ( query_SQL ) row_ where rownum =< max) where rownum_ >= min
2.SQL Server:
select top @pagesize * from tablename where id not in
(select top @pagesize*(@page-1) id
from tablename order by id) order by id
3.MySQL
select * from tablename limit position, counter
4.DB2
select * from (select *,rownumber() as ROW_NEXT from tablename) where ROW_NEXT between min and max