虚心请教,不同表某2个字段间的数据导入!!
表A:
id hynum hycount
1 101 0
2 102 0
3 103 0
....
表B:
id hynumber rebuy
1 102 50
2 103 50
3 105 30
需要实现:把B中的rebuy 导入A中对应的hycount. 条件:b.hynumber=a.hynum
------解决方案--------------------update a
set a.hycount=b.rebuy
from a inner join b on b.hynumber=a.hynum
------解决方案--------------------update 表a set hycount=表Brebuy where b.hynumber=a.hynum
------解决方案--------------------update A
set a.hycount=b.rebuy
from 表A a inner join 表B b on b.hynumber=a.hynum
------解决方案--------------------update a set hycount=rebuy
from a,b
where a.hynum=b.hynumber