各种数据库取前10行记录_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1582 | 回复: 0   主题: 各种数据库取前10行记录        下一篇 
lxk
注册用户
等级:上尉
经验:547
发帖:109
精华:0
注册:2011-8-18
状态:离线
发送短消息息给lxk 加好友    发送短消息息给lxk 发消息
发表于: IP:您无权察看 2015-7-9 18:07:22 | [全部帖] [楼主帖] 楼主

access:

select top (10) * from table1 where 1=1

db2:

select column from table where 1=1 fetch first 10 rows only

取第三行到第5行的记录

select * from (select row_number()  over() as row from table) as temp where row>=3 and row<=5

mysql:

select * from table1 where 1=1 limit 10

sql server:

读取前10条:select top (10) * from table1 where 1=1 

读取后10条:select top (10) * from table1 order by id desc

在sqlserver里面,如何读取按照某个排序,第5到10这五个记录

select top 6 * from table where id not in(select top 4 id from table)

oracle:

select * from table1 where rownum<=10

取中间记录:60~100

select * from (select rownum r,a.* from table a where rownum <= 100) where r >= 60;

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论