码迷,mamicode.com
首页 > 数据库 > 详细

关于Oracle,sqlserver,mysql中查询10-20条记录的写法

时间:2014-09-24 23:00:48      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   ar   数据   sp   on   

一: oracle数据库写法:

1:select * from (select rownum rn ,* from 表名 where?rownum<20?) a?

?where a.rn>10

2:select * from 表名 where rownum<20

  minus

  select * from 表名 where rownum<10

?

二:SqlServer数据库写法:

1:select top 20 * from tablename where id not?exists (select top?10 * from tablename)//前20条记录再过滤掉前10条

2:select top10 * from (select top 20 * from order by column) order by column desc//子查询中取20条倒序,然后从子查询中取前10条

三:mysql的写法:

select * from tablename where LIMIT 9,10


关于Oracle,sqlserver,mysql中查询10-20条记录的写法

标签:des   style   blog   http   color   ar   数据   sp   on   

原文地址:http://my.oschina.net/u/1241293/blog/318324

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!