时间:2021-07-01 10:21:17 帮助过:30人阅读
update a set DelFlag=1 from Mall_ShopAcitivityGoods a
inner join (
select SAG_GbpvID gbpvid,max(sag_id) id from Mall_ShopAcitivityGoods where SAG_ActivityID=‘20f2664e-4575-462a-93dd-f7b9eb5afade‘ and DelFlag=0 group by SAG_GbpvID
) b
on SAG_GbpvID=gbpvid and SAG_ID<>id where SAG_ActivityID=‘20f2664e-4575-462a-93dd-f7b9eb5afade‘ and DelFlag=0
Sql删除重复数据
标签:and flag set max 删除重复数据 group by 删除 acitivity PVID