美文网首页
mysql 实现字符串分割展开为多行

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

作者: zhimin_ | 来源:发表于2024-01-15 10:03 被阅读0次

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;

相关文章

网友评论

      本文标题:mysql 实现字符串分割展开为多行

      本文链接:https://www.haomeiwen.com/subject/gdezgdtx.html