场景:三张表 layer, dise, info
通过info的age字段 条件来更新layer的字段值
UPDATE layer, dise, info
set layer.blood_pressure_status = (
if(
info.age < 65,
if((layer.systolic_pressure < 140 and layer.diastolic_pressure < 90),'0','1' ) ,
if((layer.systolic_pressure < 150 and layer.diastolic_pressure < 90),'0','1' )
)
)
where layer.chronic_dise_id = dise.id
and dise.residenter_id = info.residenter_id
and layer.active = 1
and dise.active = 1
and info.active = 1
and layer.follow_status = 1
and layer.chronic_dise_type = 0