insert into  B 
(
select A.* from A
left join B 
using (id,name,address)
where B.id is null and B.name is null and B.address is null
)没有试过,看看行不行

解决方案 »

  1.   

    using (id,name,address)
    是什么意思??
      

  2.   

    USING()子句类似于ON,但连接列的名称必须在每个表中是相同的。
    using(id) == on A.id=B.id
    所以我想
    using(id,name,address) == on A.id=B.id AND A.name=B.name AND A.address=B.address详细看看MySQL手册中的用法吧。
      

  3.   

    insert ignore into a select * from b where b.name not in (select name from a);这条语句为什么执行不了??????????????????????????
      

  4.   

    to:pzou() MySQL在4.1版本才支持子查询
    to:shinesuny(方舟) 支持。
      

  5.   

    目前只有 MySQl 4.1 支持子查询
      

  6.   

    To:Arbow(◎_◎) Mysql可真落后呀。要到4.1才支持子查询?!:(我们以前的一个软件开发时的版本是3.X要是装上mysql4.X还不知以前的数据会不会还好使:(
    那这个问题不用子查询来写的话,就不能解决了么?:(有谁知道的呀?
      

  7.   

    可以用left join解决:insert ignore into a select * from b where b.name not in (select name from a);->insert ignore into a select * from b left join a on a.name=b.name where a.name is null