MySQL - update and add month from column - Asked By viper ® on 23-Sep-13 12:01 AM

Hi Everyone,

just wondering what would be the correct syntax to update and add month to my current value within mysql ?

update tableA set expiry =  expiry  +   INTERVAL 3 MONTH )  where  id = 123;

When i tried this command, im getting error :

Error during Prepare
37000(-131)[Sybase][ODBC Driver][SQL Anywhere]Syntax error near '3' on line 1


Basically i will set my expiry to add the value from another column (period columns) something like

expiry = expiry + period

as in expiry = date format 2025-09-23
period = 3 months...


Any helps to advise ?
thankyou
J
viper ® replied to viper ® on 23-Sep-13 12:45 AM
found the syntax :)
thanks everyone

update tableA set expiry = dateadd(month,perioid,expiry ) where  id = 123;