I reread your post. I think I understand it now. All of those are fields in your table?
I'm assuming it is how you are using ADDDATE(). For the interval type you are inserting a VARCHAR where it is expecting a built-in keyword. I'm assuming that is where the trouble is coming in. I'd assume that sticking in a VARCHAR won't work, but feel free to correct me. What you're doing is essentially:
Code:
SELECT DATE_ADD( '1997-12-31', INTERVAL 1 (SELECT "DAY") )
which doesn't work. But you can stick in ints in there just fine. Something like this will work:
Code:
SELECT DATE_ADD( '1997-12-31', INTERVAL (SELECT 1 ) DAY )
You may want to write a stored procedure to handle it, or throw in more ifs to handle the interval type. I think. Hope that helps some.