mysql 合并逗号隔开的字段值并去重

tech2022-12-14  109

select a.org_order, org_id, a.org_name, grid_code, a.operator_name, group_concat(distinct(a.operator)) as operator, group_concat(distinct(a.name)) as operator_name from (SELECT substring_index( substring_index( a.operator_name, ',', b.help_topic_id + 1 ), ',', - 1 ) as name, a.* FROM bdc_grid_daily a JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH(a.operator_name) - LENGTH(REPLACE(a.operator_name, ',', '')) + 1 )) a GROUP BY a.grid_code
最新回复(0)