mysql - json串新增字段
1、建表 -- 建表 drop table if exists ta_product2; CREATE TABLE ta_product2( id int primary key auto_increment, productCode varchar(50) comment '产品Code', productAttrJson text comment '产品json串' )engine=innodb; 2、插入数据 -- 插入数据 INSERT INTO ta_product2 VALUES(NULL, '20170109001','{\"saleAmount\":\"100\",\"productName\":\"20160620,-qbs002,金融\"}'); id productCode productAttrJson ------ ----------- -------------------------------------------------------------- 1 20170109001 {"saleAmount":"100","productName":"20160620,-qbs002,金融"} 3、拼接后的完整json串 SELECT t.productCode, REPLACE( t.productAttrJson, '}', CONCAT(',