1.如图
2.sql
SELECT DISTINCT
substring_index(substring_index(a.device_id, ',', b.help_topic_id + 1), ',',- 1) NAME
FROM tb_tabrecord a
JOIN mysql.help_topic b ON b.help_topic_id < (length(a.device_id) - length(REPLACE(a.device_id, ',', '')) + 1)
WHERE a.tt_id =1
substring_index() -----------------mysql 拆分函数
mysql.help_topic ----------------mysql 默认自增序列表
DISTINCT---------------------------mysql 去重复函数
查询结果
注意:如果要求拆分成多行必选要关联mysql自增表格
来源:https://blog.csdn.net/c_molione/article/details/82968554
本文同步分享在 博客“周小董”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。