读书人

判断多数据存在于多数据?该如何解决

发布时间: 2012-03-01 10:25:47 作者: rapoo

判断多数据存在于多数据?
表A 有100条记录
表B 有100000000条记录

插入表B中没有的表A记录
更新表B中 存在表A的记录

[解决办法]
insert into b(t) select a.t from a,b where b.t(+)=a.t and b.t is null
[解决办法]

SQL code
表A 有100条记录 表B 有100000000条记录 插入表B中没有的表A记录 更新表B中 存在表A的记录-----------------------------------------------insert into b select * from a where id not in (select id from b)update b set col = a.col from b,a where a.id = b.id 

读书人网 >SQL Server

热点推荐