34,874
社区成员
发帖
与我相关
我的任务
分享
select * from test where ID in(
select top 2 ID from test where ID not in (
select top 4 ID from test
))
delete from tb where id in (select top 6 id from tb where id not in (select top 4 id from tb))delete from tb where id between 5 and 6
;with aa as
(
select *,row_number() over(order by getdate()) as rw
from tb
)
delete from aa
where rw between 5 and 6
;with tt
as
(select * ,px=row_number()over(order by (select 1))
from tb)
delete tt
where px between 5 and 6
delete from tb where id in (select top 6 id from tb where id not in (select top 5 s from tb order by id asc))