I have a table with patent numbers and legal occurences as entries in one column and I would like to split up the entries in several rows. The table looks like this:
Table A:
id | patent_number | legal_status
legstat_EP12345678A1 | EP12345678 | 2019-12-02 some text | 2015-03-26 some more text | 2009-05-16 ...
legstat_US12345678B2 | US12345678B2 | 2018-08-13 more text | 2016-08-13 even more text | 2004-06-14 ...
The last column is a text column, the delimiter between entries is "|". Every such entry starts with a date (yyyy-mm-dd) followed by some text. There may be many such entries in the last column. I would like to generate a table in the following form from Table A.
Table B:
id_b | id_a | patent_number | date | legal_event
1 | legstat_EP12345678A1 | EP12345678 | 2019-12-02 | some text
2 | legstat_EP12345678A1 | EP12345678 | 2015-03-26 | some more text
3 | legstat_EP12345678A1 | EP12345678 | 2009-05-16 | ...
...
10 | legstat_US12345678B2 | US12345678B2 | 2018-08-13 | more text
11 | legstat_US12345678B2 | US12345678B2 | 2016-08-13 | even more text
12 | legstat_US12345678B2 | US12345678B2 | 2004-06-14 | ...
...
Unfortunately there is no JSON_TABLE support in MariaDB available. I found some approaches on SQL split values to multiple rows , however they did not quite work for me (either no JSON_TABLE support or problems with varying number of entries in the last column). Has anyone an idea how to approach this problem? Many thanks in advance.