标签:
With temp As ( Select ROW_NUMBER() over(partition by LogisticsPlan order by createon) rowID,ID from LogisticsPlan Where LogisticsPlan IN( ‘AGDPM15071704‘, ‘AGDDE15071401‘, ‘SGDPM15071404‘, ‘AGDPM15071404‘, ‘SGDDE15071104‘ ) ) Delete from LogisticsPlan where ID IN( Select ID from temp where rowID>1 )
该情景只用于一个字段数据重复时使用
利用ROW_NUMBER中的partition by 删除重复Key的数据
标签:
原文地址:http://www.cnblogs.com/chinabc/p/4653640.html