需要根据要求,更新数据库中客户手机号为空得数据。
目标信息由业务人员通过excel提供。格式如下:
客户编号,客户手机号,建临时表用于读取业务提供得客户待补全得信息
create table tcustinfonew
(c_custno,c_mobileno);
2,将execel的客户编号,手机号,数据导入到到临时表tcustinfonew
3,备份 create table tcustinfo20240527 select * from tcustinfo;
create table taccoinfo20240527 select * from taccoinfo ;
4,执行更新语句
update tcustinfo a
set a.c_mobileno =
(select b.c_mobileno from tcustinfonew b where a.c_custno = b.c_custno)
where exists
(select 1 from tcustinfonew where a.c_custno = b.c_custno);
update taccoinfo a
set a.c_mobileno =
(select b.c_mobileno from tcustinfonew b where a.c_custno = b.c_custno)
where exists
(select 1 from tcustinfonew b where a.c_custno = b.c_custno);
最后 验证是否更新成功