--大概如下,你根据你的业务改改,我这里没有测试。 update tb2 set = (select from tb1 where tb2.id = tb1.id) where exists(select * from tb1 where tb2.id = tb1.id)
-- 多写点。 update tb2 set = (select from tb1 where tb2.mobile_head = substr(tb1.mobile,1,tb2.mobile_count)) where exists(select * from tb1 where tb2.mobile_head = substr(tb1.mobile,1,tb2.mobile_count))
--大概如下,你根据你的业务改改,我这里没有测试。
update tb2
set = (select from tb1 where tb2.id = tb1.id)
where exists(select * from tb1 where tb2.id = tb1.id)
-- 多写点。
update tb2
set = (select from tb1 where tb2.mobile_head = substr(tb1.mobile,1,tb2.mobile_count))
where exists(select * from tb1 where tb2.mobile_head = substr(tb1.mobile,1,tb2.mobile_count))
另外需特别注意检查tb2是否存在交叉现象
如:tb2中1877又有18778,这样在更新18778开头的数据时,是按那条记录更新字段?