tableA
id | warehouse_id |
1 | 1,2 |
想要的结果:
id | warehouse_id |
1 | 1 |
2 | 2 |
select *(其他的字段), substring_index(substring_index(a.warehouse_id,',',b.help_topic_id+1),',',-1) as warehouse_id from tableA a LEFT JOIN mysql.help_topic b ON b.help_topic_id < (length(a.warehouse_id) - length(REPLACE (a.warehouse_id, ',', '')) + 1)