SQLSERVER 笔记
2023-04-18 本文已影响0人
cjjjjjj
1、删除最早的1000条数据,保留近两年的数据
delete from tableA where id in (
select top 1000 id from tableA with(nolock)
where create_date < DATEADD(year, -2, GETDATE())
order by create_date asc
)
2、
1、删除最早的1000条数据,保留近两年的数据
delete from tableA where id in (
select top 1000 id from tableA with(nolock)
where create_date < DATEADD(year, -2, GETDATE())
order by create_date asc
)
2、