mysql把字符串拆成多行的方法:可以利用SUBSTRING_INDEX()函数来进行拆分,例如【substring_index(substring_index(a.chain,'_',b.topic_id + 1)】。

可以利用字符串截取函数SUBSTRING_INDEX来实现。
(推荐教程:mysql视频教程)
语法:
SUBSTRING_INDEX(str, delimiter, count)
说明:
返回一个 str 的子字符串,在 delimiter 出现 count 次的位置截取。如果 count > 0,从则左边数起,且返回位置前的子串;如果 count
delimiter 是大小写敏感,且是多字节安全的。
安装、修复、更新或打包一个基于 Python 和 PyMySQL 实现的 Windows `mysql` 命令。适用于用户希望在 PowerShell/CMD 中输入 `mysql` 时重定向到 Python 实现、需要交互式输入 MySQL 连接信息、需要同步到当前用户本地 bin 目录,或需要将该能力封装成可公开复用的 Codex skill。
举例:
SELECT substring_index(substring_index(a.chain,'_',b.help_topic_id + 1),'_' ,- 1)AS ID FROM (select '1_11_1223_1241242' as chain) a JOIN mysql.help_topic b ON b.help_topic_id <p>执行结果:<br></p><p><img src="https://img.php.cn/upload/image/635/512/634/1601193722404440.png?x-oss-process=image/resize,p_40" title="1601193722404440.png" alt="480427f4e4a03b3ece341e5b20b18f8.png"></p><p>相关推荐:<a href="https://www.php.cn/" target="_blank">php培训</a></p>










