Here is Scenario, Adding the user-id's to the user_details
. what if external_id
does not present in the profile table and it returns null
(select statement returns null
).
How does JSON_ARRAY_APPEND
reject the query and does not add to the user_details
JSON colum.
UPDATE column1 SET user_details= JSON_SET(user_details, "$.ids", IFNULL(user_details->'$.ids',JSON_ARRAY())),
user_details= JSON_ARRAY_APPEND(user_details, "$.ids", (Select id from column2 where external_id='999999999999999'))
where id = 880;
Thanks