MySQL ADDDATE() or DATE_ADD
Posted: Wed Oct 08, 2008 4:32 am
Hi Guys,
I'm using MySQL 4.1.20
I need to add expiry date to the users table. The users table already has the joindate. The expiry date is 1 year from joint date. So I did the below SQL , which gives me error
Any suggestions guys to add one year by using the existing datetime in the table.
Thanks
I'm using MySQL 4.1.20
I need to add expiry date to the users table. The users table already has the joindate. The expiry date is 1 year from joint date. So I did the below SQL , which gives me error
Code: Select all
//registerDate datetime
//expiryDate datetime
Update jos_users set expiryDate= ADDDATE('Select registerDate from jos_users', INTERVAL 1 YEAR);
// OR
Update jos_users set expiryDate= DATE_ADD('Select registerDate from jos_users', INTERVAL 365 DAY);
// both the above SQL statements give me this optput...
(0 row(s)affected,372 warning(s))
(0 ms taken)
Thanks