SELECT `id`,
`array1`
FROM
`mimeng_test`.`t_array`
LIMIT 0, 1000;
INSERT INTO `mimeng_test`.`t_array`(id,array1) VALUES(2,'{“result”:0,”white”:[0,1,2,3}’)
1.修改json
UPDATE `mimeng_test`.`t_array` SET array1 = JSON_SET(array1,’$.result’,1,’$.white’,JSON_ARRAY(7,8,9))
WHERE id = 2
2.追加数组的值
UPDATE `mimeng_test`.`t_array` SET array1=JSON_ARRAY_APPEND(array1,’$.white’,666) WHERE id = 2;
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279798.html