表A,表B 结构相同
表A数据: 表B数据
字段1 字段2 字段3 字段4 字段1 字段2 字段3 字段4
张三 aa 123 100 张三 aa 100
李四 aa 234 101 tom bb 100
tom bb 147 100现在将表B中的数据放到表A中, 使表A表中的数据变成:
张三 aa 123 100
tom bb 147 100
应该怎么实现?高手帮忙!!!
表A数据: 表B数据
字段1 字段2 字段3 字段4 字段1 字段2 字段3 字段4
张三 aa 123 100 张三 aa 100
李四 aa 234 101 tom bb 100
tom bb 147 100现在将表B中的数据放到表A中, 使表A表中的数据变成:
张三 aa 123 100
tom bb 147 100
应该怎么实现?高手帮忙!!!
2、Update a set 字段2= (select 字段2 from b where b.字段2 is not null and b.字段1 = a.字段1)
2、Update a set 字段3= (select 字段3 from b where b.字段3 is not null and b.字段1 = a.字段1)
2、Update a set 字段4= (select 字段4 from b where b.字段4 is not null and b.字段1 = a.字段1)
2、
update a set 字段2=b.字段2,字段4=b.字段4
from a,b
where a.字段1=b.字段1
select * from b where b.字段1 is not in (select 字段1 from a )