insert 表(b) select a from 表 where a not in(select distinct b  from 表)

解决方案 »

  1.   

    insert into b
    select a.* from a left join b on a.字段一 = b.字段一 and a.字段二 = b.字段二 --and ...
    where b.字段一 is null
      

  2.   

    insert into b
    select * from a where not exists
    ( select 1 from b where a.[PrimaryKey]=b.[PrimaryKey])
      

  3.   

    其实我要插入到accessinsert into OpenRowSet
    ('microsoft.jet.oledb.4.0',';database=g:\work\db1.mdb','select * from b')
    select * from a where  a.a
    not in 
    (select * from OpenRowSet('microsoft.jet.oledb.4.0',';database=g:\work\db1.mdb','select * from b'))提示“当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。”
    什么意思?
      

  4.   

    a,b表结构相同,怎样把a中有而b中没有的数据插入b?insert into b from (select * from a)不是直接点吗?