暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Mysql跨表查询并更新

巴韭特锁螺丝 2021-12-12
68

update flow_nv_emergency_equipment_test f, purview_tbl_base_dept p set f.JCRBM = p.`name` where f.JCRBM = p.id



更新F表中的JCRBM字段,该字段取值为p表的id字段对应的name名称。


update risk_n_risk_area r, purview_tbl_base_dept p set r.SZBM = p.`id` where r.bMMC = p.name


物料表权限设置:

update danger_chemical_info d, purview_tbl_base_user p set d.auth_department_id = p.`dept_id` where d.create_id = p.id

储罐信息:

update danger_storage_tank d, purview_tbl_base_user p set d.auth_department_id = p.`dept_id` where d.create_id = p.id

储罐区信息:

update danger_storage_area d, purview_tbl_base_user p set d.auth_department_id = p.`dept_id` where d.create_id = p.id

仓库区信息:

update danger_library_area d, purview_tbl_base_user p set d.auth_department_id = p.`dept_id` where d.create_id = p.id

证书信息更新工号:

update flow_nv_certification_info f, flow_nv_people_info p set f.GH = p.`GH` where f.XM = p.XM

证书信息更新身份证号码:

update flow_nv_certification_info f, flow_nv_people_info p set f.ZSBH = p.`ZJHM` where f.XM = p.XM

证书信息更新人员id:

update flow_nv_certification_info f, flow_nv_people_info p set f.person_id = p.`id` where f.GH = p.GH

更新传感器的部门信息表(中间库sensor_ZJK,更新danger_sensor_info):

update danger_sensor_info d, sensor_ZJK s set d.bm = s.`bm` where d.sensor_code = s.sensor_code;

update danger_sensor_info d, sensor_ZJK s set d.auth_department_id = s.`auth_department_id` where d.sensor_code = s.sensor_code;

更新全流程岗位信息对应的人员(根据人员信息表里的岗位职责更新)

update jobs_info j, flow_nv_people_info p set j.people_ids = p.id where j.GWMC=p.ZGZZ;


文章转载自巴韭特锁螺丝,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论