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

如何查询表中指定序列的记录[公司面视题]

dousao 发布于 2008-04-07 11:02, 1882 次点击
譬如想要查询  20到25列的记录

[[it] 本帖最后由 dousao 于 2008-4-8 08:33 编辑 [/it]]
7 回复
#2
shezhenhui19892008-04-07 15:02
不是有top吗,或者按照between来实现
#3
dousao2008-04-08 08:32
top如何实现?我不知道,between又怎么实现?
#4
dousao2008-04-08 13:32
没人愿意回答么?
用一条嵌套的select语句,能做出么
#5
dousao2008-04-08 19:42
select top 5 *
from xx
where  
exists(
(select top 30 * from xx)  
order by desc
)
order by asc
括号能不能这么加?
#6
qboy98672008-04-09 11:12
select top 5 * from A where id not in (select top 20 id from A)
#7
论坛元老2008-04-10 15:00
[bo]以下是引用 [un]qboy9867[/un] 在 2008-4-9 11:12 的发言:[/bo]

select top 5 * from A where id not in (select top 20 id from A)

这样应该可以的
#8
lff6422008-04-25 17:41
对于这种问题.要是没有唯一列的话比较麻烦 ,要是有的话.你可以使用
--25-30
select top 5 * from tb where col not in (select top 25 col from tb ) order by col
1