MySql中某个字段存的数组,想要把数组中某个对象中的一个字段赋值给另一个字段sql
字段A为Json数组,比如[{"Path":"","SubPath":"AAAAA"},{"Path":"","SubPath":"BBBBB"}]
UPDATE table1 SET 字段A = json_set(字段A,'$[0].Path',(json_extract(字段A,'$[0].SubPath'))) WHERE 条件;
字段A为Json数组,比如[{"Path":"","SubPath":"AAAAA"},{"Path":"","SubPath":"BBBBB"}]
UPDATE table1 SET 字段A = json_set(字段A,'$[0].Path',(json_extract(字段A,'$[0].SubPath'))) WHERE 条件;