mysql 插入数据 replace into 用法

https://blog.csdn.net/wjc19911118/article/details/12152645

<!--3-26 同步库 -->
<insert id="insertLabelWarning">
REPLACE INTO hs_label_warning (
label_code,
is_warning,
label_status,
is_notice,
create_time,
update_time
) SELECT
label_code,
0 AS is_warning,
0 AS label_status,
0 AS is_notice,
now() AS create_time,
now() AS update_time
FROM
hs_label where label_code not in (select label_code from hs_label_warning and status =1)
</insert>

猜你喜欢

转载自blog.csdn.net/weixin_35756522/article/details/80351891