Hi,

I have a table that I'd like to set up along the following lines:

table events:
...
next_event      datetime
period  varchar(5)
period_t        varchar(15)
...

and at some point, do an update on every row to the tune of:

UPDATE events SET next_event = DATE_ADD(NOW(), INTERVAL period period_t);

however, I keep getting SQL errors on using a variable for the interval type. Using a 
variable for the interval length is just fine, i.e.
DATE_ADD(NOW(), INTERVAL period HOUR) is OK.

Is there a way to do this? I'd prefer not to devolve everything into seconds and do 
the math myself since it seems the functions are there.

Thanks,
-e
-- 
                                Erik Selberg
"I get by with a little help    [EMAIL PROTECTED]
 from my friends."              http://www.cs.washington.edu/homes/selberg

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to