繁体   English   中英

从其他表复制列数据的同时修改列数据

[英]modify the data of column while copying the data of column from other table

在 mysql 中,我试图将数据从一列复制到不同表的另一列。 我已经使用下面的命令来实现这一点。

insert ignore into user(payload) select payload from group;

旧列中的数据是数据:测试

新列中的数据应为{"payload":"data:test"}

截至目前,当我使用上述插入命令时,它只是从旧列中复制数据,我希望将新列更新为{"payload":"data:test"}

实际上,使用 CONCAT() function 非常简单

insert ignore into user(payload) 
    select CONCAT( '{"payload":"', payload, '"}' ) from group;

CONCAT() function 教程讲解

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM