0

Hi not sure if this is possible so wanted some guidance..

I have a database with 3 columns..

id, data,timestamp

id is auto increment and data is json array and timestamp is unix timestamp..

the field I wanted to update was data but I wanted to replace just a part of it..

see sample data below
(id, data, timestamp)
(1, '{"Employee_Number":"235","First_Name":"Test","Middle_Name":"TEST2"}',1495120538)

I wanted to replace the 235 with 544 but I will not know what data there is in the data field .. I will only know the id

I tried

UPDATE table SET data= replace(data, '{"Employee_Number":"%","First_Name"', '{"Employee_Number":"544","First_Name"') WHERE id = '1'

but the issue is that % cannot be used as wildcard in replace..

Any suggestions will help

Thanks

2
Contributors
3
Replies
17
Views
4 Months
Discussion Span
Last Post by cereal
0

ahh brill

does the field needs to be specific type? or varchar is ok?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.