把库1中的记录删除
条件:库1.dbo.表1.字段<>库2.dbo.表2.字段
下面代码说"无法绑定由多个部分组成的标识符库2.dbo.表2.字段"
delete
from 库1.dbo.表1
where (库1.dbo.表1.字段<>库2.dbo.表2.字段)
条件:库1.dbo.表1.字段<>库2.dbo.表2.字段
下面代码说"无法绑定由多个部分组成的标识符库2.dbo.表2.字段"
delete
from 库1.dbo.表1
where (库1.dbo.表1.字段<>库2.dbo.表2.字段)
from 库1.dbo.表1 a,库2.dbo.表2 b
where a.字段<>b.字段
from 库1.dbo.表1 ,库2.dbo.表2
where (库1.dbo.表1.字段 <>库2.dbo.表2.字段) 怎摸数据库中的记录都没了?
看懂这个很重要。
from 库1.dbo.表1 a left out join 库2.dbo.表2 b on a.字段=b.字段
where b.字段 is null
from 库1.dbo.表1
where 库1.dbo.表1.字段 not in (select 库2.dbo.表2.字段 from 库2.dbo.表2)
看不太懂
where 库1.dbo.表1.字段 not in (select 字段 from 库2.dbo.表2.字段)
delete from 库1.dbo.表1 a
where not exists(
select *
from 库2.dbo.表2 b
where a.field1 = b.field1)