I have a table with json columns with default empty arrays [].
old table
id | myJson |
---|---|
A1 | [1, 2] |
A12 | [] |
I want the table updated to below.
id | myJson |
---|---|
A1 | [1, 2, 321, 432] |
A12 | [222] |
Tried - INSERT INTO table (id, myJson) VALUES ("A1", "[321, 432]"), ("A12", "[222]") ON DUPLICATE KEY UPDATE myJson = JSON_ARRAY_APPEND(myJson, "$", myJson)
Above query and other tried so far did not produce desirable result.
What query can i use to append new arrays to old as shown in the tables?