mysql中varchar类型和datetime类型字段进行比较


我是在mysql5.7版本进行比较

表a的字段order_no和表iwebshop_tmp的字段order_no一样

需要更新iwebshop_member_order表的datetime类型expiration_time,和表b的varchar类型deadline值一样;

update iwebshop_member_order as a join iwebshop_tmp as b on a.order_no = b.order_no set a.expiration_time = b.deadline where a.expiration_time = 0;

以上是报错

 

以下正常:

update iwebshop_member_order as a join iwebshop_tmp as b on a.order_no = b.order_no set a.expiration_time = str_to_date(b.deadline,'%Y-%m-%d %H:%i:%s') where a.expiration_time = 0;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM