假设有表type 字段有name, count
我用select * from type order by count 查询出的数据如下:
name count
11 11
22 22
33 33
44 44
55 55
现在我要查询出的数据不显示最上面的一行 或者两行 怎么实现???
我用select * from type order by count 查询出的数据如下:
name count
11 11
22 22
33 33
44 44
55 55
现在我要查询出的数据不显示最上面的一行 或者两行 怎么实现???
add id int identity(1,1)
select * from type where id not in(1,2)
orselect * from type
where name not in (select top 2 name from type order by name )
---方法1
Select * From type As A Where Exists
(Select 1 From type Where Count<A.count)
Order By Count
---方法2
Select * From (
Select Top 4 * From Type Order By Count Desc
) T Order By Count
---不显示上面那二行
Select * From (
Select Top 3 * From Type Order By Count Desc
) T Order By Count
SELECT A.NAME,A.COUNT FROM TYPE A WHERE NOT EXISTS (SELECT MIN(B.COUNT) FROM TYPE B WHERE B.NAME=A.NAME)