标签:and flag set max 删除重复数据 group by 删除 acitivity PVID
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
标签:and flag set max 删除重复数据 group by 删除 acitivity PVID
原文地址:https://www.cnblogs.com/lianjinzhe/p/11589513.html