I'm trying to add an integer to a date but I get the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(wp.OrderDate, INTERVAL WPProduct.Duration DAY) AS ExpiryDate FROM wp' at line 6
SELECT
wp.customers_id,
wp.OrderDate,
wp.products_id,
WPProduct.Duration,
DATE_ADD (wp.OrderDate, INTERVAL WPProduct.Duration DAY) AS ExpiryDate
FROM wp
INNER JOIN WPProduct ON WPProduct.products_id = wp.products_id
WHERE wp.customers_id = 2
WPProduce.Durationallowed to be null? It might not like the possibility of adding a null value to datewp(uservarchar(32) NOT NULL default '',customers_idint(11) NOT NULL,OrderDatedatetime NOT NULL,products_idint(11) NOT NULL, PRIMARY KEY (user), UNIQUE KEYcustomers_id(customers_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;