把库1中的记录删除
条件:库1.dbo.表1.字段<>库2.dbo.表2.字段
下面代码说"无法绑定由多个部分组成的标识符库2.dbo.表2.字段"
delete
from 库1.dbo.表1
where (库1.dbo.表1.字段<>库2.dbo.表2.字段)

解决方案 »

  1.   

    delete a
    from 库1.dbo.表1 a,库2.dbo.表2 b
    where a.字段<>b.字段
      

  2.   

    delete 库1.dbo.表1
    from 库1.dbo.表1 ,库2.dbo.表2
    where (库1.dbo.表1.字段 <>库2.dbo.表2.字段) 怎摸数据库中的记录都没了?
      

  3.   

    where (库1.dbo.表1.字段  <>库2.dbo.表2.字段)  
    看懂这个很重要。
      

  4.   

    delete a
    from 库1.dbo.表1 a left out join 库2.dbo.表2 b on a.字段=b.字段
    where b.字段 is null
      

  5.   

    delete 
    from 库1.dbo.表1 
    where 库1.dbo.表1.字段 not in (select 库2.dbo.表2.字段 from  库2.dbo.表2) 
      

  6.   

    from 库1.dbo.表1 a left out join 库2.dbo.表2 b on a.字段=b.字段
    看不太懂
      

  7.   

    这样删肯定都没了delete from 库1.dbo.表1
    where 库1.dbo.表1.字段 not in (select 字段 from 库2.dbo.表2.字段)
      

  8.   


    delete from 库1.dbo.表1   a
    where not exists(
    select *
      from 库2.dbo.表2 b
    where a.field1 = b.field1)
      

  9.   

    听说exists的效率比in要高点,具体我没有测试过