首页 > 数据库技术 > 详细

新思路 mysql关于 replace函数用法解决数据更新或新增

时间:2021-07-07 18:33:21      阅读:15      评论:0      收藏:0      [点我收藏+]

最近重构项目中,涉及到表结构变更, 需要对原来的数据做代码层面的双向更新,保证数据一致性。发现mysql中有REPLACE 函数

REPLACE INTO coupon_test.w_user_coupon_use_record( id,user_id_code, user_coupon_id, order_sn, coupon_type, order_id, status, rule_config, biz_code, created_time, updated_time, deleted_time) VALUES (29, 2594277, 17191161, ‘160576703474599524277‘, 6, 0, 1, ‘[{"amount":100,"discount":0.0,"level":1,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":2,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":3,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":4,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":5,"promotionId":1010335,"step":1}]‘, ‘‘, ‘2020-11-19 14:23:56‘, ‘2021-01-23 11:48:59‘, NULL);

新思路 mysql关于 replace函数用法解决数据更新或新增

原文:https://www.cnblogs.com/jinjian91/p/14982137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!