Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1080026
  • 博文数量: 165
  • 博客积分: 3900
  • 博客等级: 中校
  • 技术积分: 1887
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-06 15:15
文章分类

全部博文(165)

文章存档

2020年(3)

2019年(8)

2017年(2)

2016年(8)

2015年(14)

2013年(15)

2012年(32)

2011年(11)

2010年(14)

2009年(7)

2008年(20)

2007年(31)

分类: Mysql/postgreSQL

2008-11-27 11:22:56

各种数据库取前10行记录
access:
select top (10) * from table1 where 1=1
db2:
select column from table where 1=1 fetch first 10 rows only
取第3行到第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;
 
阅读(2042) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~