I have two tables, for example's sake I simplified it:
Table A
| id | data |
|---|---|
| 1 | [ { "b_id": 1 }, { "b_id": 2 } ] |
| 2 | [ { "b_id": 2 }, { "b_id": 3 } ] |
| 3 | NULL |
Table B
| id | name |
|---|---|
| 1 | random |
| 2 | foo |
| 3 | bar |
I would like to select the data column from Table A but with each json array element including the corresponding name from Table B, so the result would look something like this
SELECt ... FROM TableA LEFT JOIN TableB ON ...
| data |
|---|
| [ { "b_id": 1, "b_name": "random" }, { "b_id": 2, "b_name": "foo" } ] |
| [ { "b_id": 2, "b_name": "foo" }, { "b_id": 3, "b_name": "bar" } ] |
| NULL |
Edit: MariaDB version: 11.2.2-MariaDB-1:11.2.2+maria~ubu2004-log