各种数据库的分页查询语句

原创
2016-06-07 15:22:03 818浏览

各种数据库的分页查询语句 1.oracle数据库分页select * from (select a.*,rownum rc from 表名 where rownum=endrow) a where a.rc=startrow2.DB2数据库分页Select * from (select rownumber() over() as rc,a.* from (select * from 表名 order by 列名) as

各种数据库的分页查询语句

1.oracle数据库分页
select * from (select a.*,rownum rc from 表名 where rownum=startrow

2.DB2数据库分页
Select * from (select rownumber() over() as rc,a.* from (select * from 表名 order by 列名) as a) where rc between startrow and endrow

3.SQL Server 2000数据库分页
Select top pagesize * from 表名 where 列名 not  in(select top pagesize*page 列名 from  表名 order by 列名) order by 列名

4.SQL Server 2005数据库分页
Select * from (select 列名,row_搜索number() over(order by  列名1) as 别名from 表名) as t where t.列名1>=startrow and t.列名1


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。