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