mysql 实现字符串分割展开为多行

2024-01-15  本文已影响0人  zhimin_

https://www.cnblogs.com/gered/p/10797012.html

示例

我的表:image_label_mapping_v5
mysql help表:mysql.help_topic b on b.help_topic_id

SELECT
a.tag, SUBSTRING_INDEX(SUBSTRING_INDEX(a.tag,'#', b.help_topic_id + 1), '#' , -1) 
FROM image_label_mapping_v5 a 
JOIN mysql.help_topic b on b.help_topic_id < (LENGTH(a.tag) - LENGTH(REPLACE(a.tag,'#','')) + 1)
WHERE type = 11;
上一篇 下一篇

猜你喜欢

热点阅读