表a:
单位   部门表b:
单位  部门   ..............表a是单位部门表,怎么样用sql语句将表b中没有而表a的有的记录插入到表b中?
单位和部门确定一条记录.谢谢了

解决方案 »

  1.   

    insert into B from a,b where not (a.單位 in b.單位) and not (a.部門 in b.部門)
      

  2.   

    insert into b from select * from a where not exists (select * from b)
      

  3.   

    一楼明白我的意思,但那样写是不对的,二楼的写法,oracle不支持
      

  4.   

    insert into b from select * from a where not exists  (select 1 from b where a.部门=b.部门 and a.单位=b.单位)