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

mysql查询和修改指定数据库中所有表中包含的某个字段

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

1、查询solar_lh库中包含auth_department_id的所有表:

SELECT

TABLE_NAME '表名',

COLUMN_NAME '字段'

FROM

information_schema. COLUMNS

WHERE

TABLE_SCHEMA = 'solar_lh'

AND COLUMN_NAME = 'auth_department_id'

select table_name from information_schema.columns where table_schema = 'solar_lh' and column_name='auth_department_id';

2、修改系统中所有审核状态为通过;

update flow_nv_blind_plate_work  set SHZT='3' where SHZT!='3';

update flow_nv_break_circuit_work set SHZT='3' where SHZT!='3';

update flow_nv_break_ground_work set SHZT='3' where SHZT!='3';

update flow_nv_confined_space_work set SHZT='3' where SHZT!='3';

update flow_nv_contractor set SHZT='3' where SHZT!='3';

update flow_nv_contractor_out set SHZT='3' where SHZT!='3';

update flow_nv_danger_interlock set SHZT='3' where SHZT!='3';

update flow_nv_facility_work set SHZT='3' where SHZT!='3';

update flow_nv_fire_work set SHZT='3' where SHZT!='3';

update flow_nv_height_work set SHZT='3' where SHZT!='3';

update flow_nv_hoisting_work set SHZT='3' where SHZT!='3';

update flow_nv_hydrogen_work set SHZT='3' where SHZT!='3';

update flow_nv_industrial_injury set SHZT='3' where SHZT!='3';

update flow_nv_inspection_point_content_relate set SHZT='3' where SHZT!='3';

update flow_nv_inspection_point_dept_check set SHZT='3' where SHZT!='3';

update flow_nv_law_regulation set SHZT='3' where SHZT!='3';

update flow_nv_operate_regulation set SHZT='3' where SHZT!='3';

update flow_nv_safety_regulation set SHZT='3' where SHZT!='3';

update flow_nv_temporary_electricity_work set SHZT='3' where SHZT!='3';

update flow_nv_train_record set SHZT='3' where SHZT!='3';

update flow_nv_work_management set SHZT='3' where SHZT!='3';

update flow_pf_accident_info set SHZT='3' where SHZT!='3';



update flow_nv_emergency_drill     set publish_status = '2' where publish_status!='2';

update flow_nv_emergency_drill_parent set publish_status = '2' where publish_status!='2';

update flow_nv_emergency_plan set publish_status = '2' where publish_status!='2';

update flow_nv_operate_regulation set publish_status = '2' where publish_status!='2';

update flow_nv_safety_regulation set publish_status = '2' where publish_status!='2';





update flow_nv_emergency_drill set audit_status='3' where audit_status!='3';

update flow_nv_emergency_drill_parent set audit_status='3' where audit_status!='3';

update flow_nv_emergency_plan set audit_status='3' where audit_status!='3';

update flow_pf_accident_rectification set audit_status='3' where audit_status!='3';

update flow_pf_craft_audit set audit_status='3' where audit_status!='3';

update risk_tbl_quota_evaluation_reform set audit_status='3' where audit_status!='3';

update risk_tbl_quota_model set audit_status='3' where audit_status!='3';



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

评论