Skip to content
Advertisement

Updating the Fields in the JSON_ARRAY Mysql 8.0

Here is my scenario, I want to update the hourly_rate for the BOB to 600. How to extract the hourly_rate from the json_array mentioned below for the specific user BOB.

Can I use JSON_SEARCH() to get the index by using Where Clause.

example:

Advertisement

Answer

I got this working. But I had to use a view in order to get cleaner code.

My answer is based on this one: https://stackoverflow.com/a/51563616/1688441


Update Query

Fiddle @ https://www.db-fiddle.com/f/7MnPYEJW2uiGYaPhSSjtKa/1


Ddl

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement