在mysql中更新日期+一年 [英] Update date + one year in mysql
本文介绍了在mysql中更新日期+一年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我想在mysql表中设置数值+1时,我使用例如:
更新表SET number = number + 1 WHEN ...
如何设置日期+一年?
谢谢
解决方案
您可以使用 DATE_ADD :(或 ADDDATE with INTERVAL
)
更新表SET date = DATE_ADD(date,INTERVAL 1 YEAR)
pre>
When I want setting numerical value +1 in mysql table, I use e.g.:
UPDATE table SET number=number+1 WHEN ...
How can I set date + one year?
Thanks
解决方案You could use DATE_ADD : (or ADDDATE with
INTERVAL
)UPDATE table SET date = DATE_ADD(date, INTERVAL 1 YEAR)
这篇关于在mysql中更新日期+一年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文