我可以知道下面的sql语句有什么问题吗?我给出了一个错误"错误的日期时间值"。
UPDATE stocks SET Notes = '0' where ExpireDate like '%2017-12-28%' and StockCount > 0;
答案 0 :(得分:1)
试试这个:
SET sql_safe_updates = 0;
UPDATE STOCKS
SET NOTES = '0'
WHERE EXPIREDATE = CURDATE()
AND STOCKCOUNT > 0;
SET sql_safe_updates = 1;