简体   繁体   中英

How to do this simple math in a mysql query?

I have a db column called timestamp which is exactly what it holds. I want to get the sum of the timestamp and 10 days. How will that query look?

In other words how can I say this in:

SHOW ME THE RESULT OF TIMESTAMP + 10 DAYS;

in working sql syntax of course :)

I think what you want is something like:

SELECT DATE_ADD(NOW(),INTERVAL 10 day);

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add

尝试这个:

SELECT DATE_ADD(`timestamp`, INTERVAL 10 DAY) FROM `table`;

尝试这个:

SELECT ADDDATE(timestamp, 10) from tablename;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM