1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 不同数据库Oracle MySQL SQL Server DB2 infomix sybase分页查询语句

不同数据库Oracle MySQL SQL Server DB2 infomix sybase分页查询语句

时间:2019-04-07 19:39:51

相关推荐

不同数据库Oracle MySQL SQL Server DB2 infomix sybase分页查询语句

数据库|mysql教程

Oracle分页查询语句,不同数据库Oracle MySQL

数据库-mysql教程

带后台管理 源码,ubuntu系统下操作,一小时手写tomcat,恐龙园爬虫馆,php根据下拉框显示不同内容,品牌推广seolzw

不同数据库Oracle MySQL SQL Server DB2 infomix sybase分页查询语句

记账app安卓源码,vscode 禁止检验js,ubuntu 凯立德,tomcat io 阻塞,sqlite给表格重命名,有种屁爬虫周围红色中间黑色,php获取表单提交,淮北爱采购seo,网站克隆软件破解版,网页登录框 震动效果,已seo的dede模板lzw

会员管理软件开发源码,vscode选择快捷键,ubuntu中mobi,tomcat闪退 1,网页嵌入爬虫,php上传文件无刷新,seo黑帽优化快速排名,带分享的网站,室内装饰网站模板lzw

在不同数据库中的使用的分页查询语句:

当前页:currentpage

页大小:pagesize

1. Oracle数据库

select * from (select A.*,rownum rn from ( QUERY_SQL ) A ) where rn (currentpage*pagesize)

注:QUERY_SQL为查询sql语句。

select * from (select rownum rn,id from TABLENAME where rownum = (currentpage*pagesize)

2. Infomix数据库

select skip currentpage first pagesize * from TABLENAME

3. DB2数据库

select * from (select 字段1,字段2,字段3,rownumber() over(order by 排序用的列名 asc) as RN from 表名) as A1 where A1.RN between (currentpage*pagesize) and ((currentpage+1)*pagesize)

select * from (select rownumber() over(order by id asc ) as rowid from table where rowid (currentpage*pagesize)

4. SQL Server数据库

select top pagesize *

from TABLENAME

where COLLUMN_NO not in

(select top currentpage*pagesize COLLUMN_NO from TABLENAME order by COLLUMN_NO)

order by COLLUMN_NO

5. Sybase数据库

Sybase 12.5.3版本支持top查询,,或使用set rowcount N查询头N条数据

另外采用临时表:

select rowid=identity(12), column_name into #TEMPTABLE from TABLENAME

select column_name from #TEMPTABLE where rowid >(currentpage*pagesize) and rowid < (currentpage*pagesize+pagesize)

6. MySQL数据库

SELECT * FROM TABLE1 LIMIT (currentpage*pagesize),pagesize

本文永久更新链接地址:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。