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);
As close as I got by following the examples of '@fthiella' and '@RGarcia'.
Please see fiddle here.
The result I get is different than expected in "I want output like this:"
I want output like this
| 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|