select * from 表 where 主键 not in (select top 数字 主键 from 表)
select * from table where id not in (select top n id from table )
select * from table where id not in (select top n id from table )
select * ,identity(int,1,1) as aa into #aa from table select * from #aa where aa>=n
to 2L3L, 我的表中没有类似ID编号这类主键~to 6L, 编译通过,但执行时候报错Cannot add identity column, using the SELECT INTO statement, to table '#aa', which already has column 'ID' that inherits the identity property.
Cannot add identity column, using the SELECT INTO statement, to table '#aa', which already has column 'ID' that inherits the identity property.--------------------------------- 是不是你的表有id 字段??lwl0606(寒泉) 的方法是正确的
s column 'ID' that inherits the identity property. 是说你有一个字段ID 具有 identity 属性,这个字段就可以做主键来用, 这样就可以了 select * from table where id not in (select top n id from table )
select *
from table
where id not in (select top n id from table )
into #aa
from table select *
from #aa
where aa>=n
是不是你的表有id 字段??lwl0606(寒泉) 的方法是正确的
是说你有一个字段ID 具有 identity 属性,这个字段就可以做主键来用,
这样就可以了
select *
from table
where id not in (select top n id from table )