hue manny hue manny - 5 months ago 10
SQL Question

How to add multiple intervals to Date_Add

I want to add 2 months and 2 years to the current date but for some reason i cannot get it to work.

Select DATE_ADD(NOW(), INTERVAL 2 MONTH, INTERVAL 2 YEAR);

Answer

Try using date_add() twice:

Select DATE_ADD(DATE_ADD(NOW(), INTERVAL 2 MONTH), INTERVAL 2 YEAR);

Or once:

Select DATE_ADD(NOW(), INTERVAL 14 MONTH);