“在不存在的地方插入”是否包括在同一插入处插入的记录

问题描述

表1-ID,名称,地址,项目,日期,价格...

表2-ID,名称,项目

表2不能有重复的行(而表1可能有一些)。

通过使用“在不存在的地方插入”,插入其中的包含行本身会插入吗?

insert into table2 (id,name,item)
select id,item
from table1
where not exists 
(select 1 from table2 where table2.id=table1.id and table2.name=table1.name and table2.item=table1.item) 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)