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
博客介绍了不同数据库的分页查询SQL语句,包括Oracle、SQL Server、MySQL和DB2。针对不同数据库,给出了具体的分页查询代码,如Oracle使用rownum,SQL Server用top和not in,MySQL用limit,DB2用rownumber()。
2923

被折叠的 条评论
为什么被折叠?



