数据库
首页 > 数据库> > 解决sql update 不能使用 cast convert函数

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

作者:互联网

错误点

在这里插入图片描述


 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

在这里插入图片描述

  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

标签:convert,46,pa,hp,cast,weather,lighting,sql,select
来源: https://blog.csdn.net/weixin_42390534/article/details/95646537