开发者

Set date as three days before

I am wondering if this looks like the right way to开发者_如何学运维 do things:

UPDATE table SET `date2` = date_sub(`date1`,interval -2 day);

I would like to set the date on the date2 column to two days before the date on the date1 column.

Thanks for any insight!


I seldom use the DATE_SUB() or DATE_ADD() functions, because it's more clear to just use date arithmetic.

UPDATE table SET `date2` = `date1` - interval 2 day;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜