I have the following field (which is a string) of one of my tables:
'[{"id":"6","value":["http://www.google.com","http://www.google.com","new"]},
{"id":"7","value":"Reuters"},
{"id":"20","value":"2017/03/17"}]'`
As you can see, the last part, the one with id=20
has a date on it, 2017/03/17
.
Can someone tell me how can I update that field so I can get the output 2017-03-17
?
My desired output after the update would be:
'[{"id":"6","value":["http://www.google.com","http://www.google.com","new"]},
{"id":"7","value":"Reuters"},
{"id":"20","value":"2017-03-17"}]'`
If I use:
UPDATE mytable
SET myfield = replace(myfield , '/', '-');
It removes the /
of the links, and I want to mantain them.
PS: The ids of the fields are always the same (the one for the date is always 20
for example) the only thing that changes are the values.