只知道你的三个字段、你试试insert into b.temp1(id,date,barcode) select id,date,barcode from a.temp1 left join b.temp1 on a.id = b.id and a.date = b.date and a.barcode = b.barcode where b.id is null
ignore insert into B.test1 select * from A.test1;
insert into b select a.* from a left join b on a.id=b.id where b.id is null
这个是追加重复的记录? where b.id is null 只会查出不在b表的数据? 怎么会重复呢?
如果是重复的记录,则主键ID相同,字段date,barcode也相同。
select id,date,barcode from a.temp1 left join b.temp1 on a.id = b.id and a.date = b.date and a.barcode = b.barcode where b.id is null
select a.* from a left join b on a.id=b.id where b.id is null
这个是追加重复的记录?
where b.id is null
只会查出不在b表的数据?
怎么会重复呢?