我有一个名为“PIDs”的列,它看起来像:
“48,162,48,26,19”
是否有可能清除重复项?喜欢:
“48,162,26,19”?
谢谢
我的 SQL 语句如下所示:
select id, CIDs, COLOR, XT, MP, Name, concat(PIDs,",",GROUP_CONCAT(DISTINCT id)) as PIDs, IFNULL(Name,id) as unqName from ( select id, CIDs, COLOR, XT, MP , Name, concat(PIDs,",",GROUP_CONCAT(DISTINCT id)) 作为 PIDs, IFNULL(MP,id) 作为 unqMP from ( select id, CIDs, COLOR, XT, MP, Name, concat(PIDs,"," ,GROUP_CONCAT(DISTINCT id)) 作为 PIDs, IFNULL(XT,id) 作为 unqXT from (select id, CIDs, COLOR, XT, MP, Name, GROUP_CONCAT(DISTINCT id) 作为 PIDs, IFNULL(COLOR,id) 作为 unqCOLOR from Produkte group by unqCOLOR ) m group by unqXT ) x group by unqMP ) y group by unqName