The data in the Response column is = blahblahblahTYPE=ERRORblahblah
. I then run the query below to just target the 'ERROR' string.
SELECT substr(Response, instr(Response, 'ERROR'), 5)
FROM table
WHERE id = 721451
AND Status = 'false'
AND Response LIKE '%<status>Unknown</status>%'
AND date >= curdate();
The query above returns: ERROR
.
I basically want to update ERROR
to SUCCESS
without editing the rest of the data.
Would the query below work? Is there a better way to do this?
UPDATE table
SET Response = 'SUCCESS'
WHERE (
SELECT substr(Response, instr(Response, 'ERROR'), 5)
FROM table
WHERE id = 721451
AND Status = 'false'
AND Response LIKE '%<status>Unknown</status>%'
AND date >= curdate()
);
Thanks for your help in advance!