dousao 发表于 2008-4-7 11:02

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

譬如想要查询  20到25列的记录

[[it] 本帖最后由 dousao 于 2008-4-8 08:33 编辑 [/it]]

shezhenhui1989 发表于 2008-4-7 15:02

不是有top吗,或者按照between来实现

dousao 发表于 2008-4-8 08:32

top如何实现?我不知道,between又怎么实现?

dousao 发表于 2008-4-8 13:32

没人愿意回答么?
用一条嵌套的select语句,能做出么

dousao 发表于 2008-4-8 19:42

select top 5 *
from xx
where  
exists(
(select top 30 * from xx)  
order by desc
)
order by asc
括号能不能这么加?

qboy9867 发表于 2008-4-9 11:12

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

论坛元老 发表于 2008-4-10 15:00

[quote][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) [/quote]
这样应该可以的

lff642 发表于 2008-4-25 17:41

对于这种问题.要是没有唯一列的话比较麻烦 ,要是有的话.你可以使用
--25-30
select top 5 * from tb where col not in (select top 25 col from tb ) order by col

页: [1]

编程论坛