[步骤]
点击导入,输入主干测试环境sku167131521
165667291
20302020
20301735
20301434
20300239
20300022
20299945
20292997
20290912
20285144
20283522
20277076
20138923
20132999
20050685
20006832
19923779
19923632
19804959
19743466
19743348
19674492
19659911
19656490,点击确定
[结果]

[期望]
select a.SKU, a.ProductColor
,(pca.AttrName+' '+pca.AttrNameCn ) as CommonAttrColor
from RB_Product (nolock) a
left join E_Product_CommonAttr(nolock) pca on pca.AttrType='Color' and pca.AttrName=a.ProductColor
where a.SKU in (
'167131521','165667291','20302020','20301735','20301434','20300239','20300022','20299945','20292997','20290912','20285144','20283522','20277076','20138923','20132999','20050685','20006832','19923779','19923632','19804959','19743466','19743348','19674492','19659911','19656490,'
)
解决方案:清理掉多余数据
delete from E_Product_CommonAttr where Id not in(
select t.Id from (
SELECT MIN(ID) as ID,AttrType,AttrName FROM [dbo].[E_Product_CommonAttr] GROUP BY AttrType,AttrName
)t
)