注册 登录
编程论坛 SQL Server论坛

[求助] MS SQL 有没有Limit? 或对应Limit的方法

rainic 发布于 2007-05-21 23:15, 1407 次点击
RT
9 回复
#2
棉花糖ONE2007-05-22 00:41

没有limit只有top

#3
rainic2007-05-22 09:52

那就不好了
如果我想取出第31条到60条之间的数据应该怎么做?

#4
初学Delphi2007-05-22 10:42
需要有主键
可以用 not in 或者 not exists来做
#5
初学Delphi2007-05-22 10:43
没主键,有unique的列也可以
#6
bygg2007-05-22 11:41

用rownum ...

#7
棉花糖ONE2007-05-22 13:11

rownum是oracle里面的

#8
rainic2007-05-22 13:51
not in ?? not exists?

这样的SQL具体怎么写呢?

光看提示我想不出来
#9
bygg2007-05-22 14:14
#10
初学Delphi2007-05-23 11:29

not in
保证这列值没重复的

select top 3 * from table where lie1 not in (select top 7 lie1 from table)
这是取的8,9,10行数据

[此贴子已经被作者于2007-5-23 11:31:22编辑过]

1