开发者

Set date as three days before

开发者 https://www.devze.com 2023-03-16 15:26 出处:网络
I am wondering if this looks like the right way to开发者_如何学运维 do things: UPDATE table SET `date2` = date_sub(`date1`,interval -2 day);

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

精彩评论

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