Oracle分页-MS SQL Server 2000分页-MySQL分页
上一篇 /
下一篇 2011-08-03 21:29:11
/ 个人分类:Oracle学习心得
Oracle分页-MS SQL Server 2000分页-MySQL分页
初始定义:
pageSize:每页显示大小
pageNum:第几页
Oracle分页:
minus差分页:
select * from table where rownum<=pageSize*pageNum minus select * from table where rownum<=(pageSize-1)*pageNum
例子:
select * from table where rownum<=10 minus select * from table where rownum<=5
两个关联表的符合条件记录的交集,是于union作用相反.
例:
select * from table where rownum<=20
minus
select *from table where rownum<=10
SQLServer分页:
select top pageSize*pageNum from table where id not in(select top (pageSize-1)*pageNum id from table );
例子
select top 5 * from table where id not in(select top 0 id from table);
MySQL分页:
select * from table limit (pageSize-1)*pageNum,pageSize*pageNum;
例子:
select * from table limit 0,5;
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: