解决sql update 不能使用 cast convert函数

错误点

解决sql update 不能使用 cast convert函数_第1张图片


 update  lighting_weather_info set `status`=''  where weather_info_id in( select * from (select weather_info_id
 FROM lighting_weather_info
 WHERE (CONVERT(pa_hp,DECIMAL)>(select indexhightvalue
 FROM lighting_equipment_index
 WHERE indexcode='pa_hp') or CONVERT(pa_hp,DECIMAL) < (select indexlowvalue
 FROM lighting_equipment_index
 WHERE indexcode='pa_hp')) and equipmentid='AY1009' and (updatetime BETWEEN '2019-03-12 18:46:46' and '2019-12-12 18:46:46')) sd)

解决 在update之后 加上 IGNORE

解决sql update 不能使用 cast convert函数_第2张图片

  update **IGNORE** lighting_weather_info set `status`=''  where weather_info_id in( select * from (select weather_info_id
 FROM lighting_weather_info
 WHERE (CONVERT(pa_hp,DECIMAL)>(select indexhightvalue
 FROM lighting_equipment_index
 WHERE indexcode='pa_hp') or CONVERT(pa_hp,DECIMAL) < (select indexlowvalue
 FROM lighting_equipment_index
 WHERE indexcode='pa_hp')) and equipmentid='AY1009' and (updatetime BETWEEN '2019-03-12 18:46:46' and '2019-12-12 18:46:46')) sd)
 

增加也可以使用O

你可能感兴趣的:(sql,Error)