如何在列mysql中使用多个子索引拆分多个子值?

问题描述

CREATE TABLE tablename (id INT,C1 text);

INSERT INTO tablename VALUES
(1,'[AU 1] string 1; [AU 2] string 2; [AU 3] string 3.1; string 3.2; [AU 4] string 4.1; string 4.2; [AU 5] string 5'),(2,'[AU 1; AU 2] string 1'),(3,'[AU 1] string 1; [AU 2] string 2');

CREATE TABLE numbers (n INT PRIMARY KEY);
INSERT INTO numbers VALUES (1),(2),(3),(4),(5),(6);

通过关注“@fthiella”和“@RGarcia”的例子,我得到了尽可能接近。

请参阅小提琴 here

我得到的结果与“我想要这样的输出:”中的预期不同:

我想要这样的输出

| ID | AU   | ORG |
| 1  |[AU 1]|string_1|
| 1  |[AU 2]|string_2|
| 1  |[AU 3]|string_3.1|
| 1  |[AU 3]|string_3.2|
| 1  |[AU 4]|string_4.1|
| 1  |[AU 4]|string_4.2|
| 1  |[AU 5]|string_5|
| 2  |[AU 1; AU 2]|string_1|
| 3  |[AU 1]|string_1|
| 3  |[AU 2]|string_2|

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)