I need to update a json value in a column as well as update another column in the same query.
Something like this:
UPDATE fixtures
SET jsonResults = '{}',
JSON_SET(jsonFixture, '$.time_status', '0')
WHERE intRefID = 88961323;
How can I accomplish this?
JSON_SET()
returns a JSON document value, but an UPDATE statement needs a series of assignment expressions:This replaces
jsonFixture
with the result ofJSON_SET()
, after setting a field within that document.Compare with an UPDATE like this:
It takes the value of
i
, adds 1, and then uses the result of that addition expression to replacei
.