mysql根据指定指定字符拆分某个字段,分割成多条记录

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根据指定指定字符拆分某个字段,分割成多条记录

相关文章:

  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
猜你喜欢
  • 2021-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案