宗小宗-PHP程序猿

欢迎各位朋友前来,如果我的文章中有不对的地方,还望指正;如需转载,请注明原处

从一个表查数据修改另外一张表的数据

update op_system.ops_system_user a,msip_bhu_core.t_vas_users b 
set a.bid=b.id
where a.username=b.mobileno and a.bid is null;

update ops_device_flow a,ops_device_flow b 
set a.next_uid=b.to_uid,a.status='0' 
where a.device_sn=b.device_sn and a.to_uid=b.from_uid and b.to_uid<>0 and a.next_uid is null;

update ops_system_user a 
set device_count=(select count(*) from ops_device_flow where to_uid=a.id);

 

posted @ 2016-10-31 14:45  宗小宗  阅读(825)  评论(0编辑  收藏  举报