Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前我的日期格式为 01/01/2012。如何更新 mysql 记录以设置从 01/01/2013 到 2013-01-01 的日期,而不必单独执行每个日期?
update table set date='2012-01-01' where date='01/01/2012'
使用DATE_FORMAT()和STR_TO_DATE()
DATE_FORMAT()
STR_TO_DATE()
UPDATE tablename SET date = DATE_FORMAT(STR_TO_DATE(date, "%d/%m/%Y"), "%Y-%m-%d")