|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Arbitrary interval for DATE_ADD()
From: Adam Carmichael (adamc
no1.com.au)
Date: Sat Jan 03 2004 - 06:03:41 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello List,
I'm trying to write a query that will use the DATE_ADD() function, but
with a variable interval based upon a database value in similar style
SELECT DATE_ADD(NOW(),tbl_name.interval) AS date
FROM tbl_name;
With the text string 'INTERVAL 1 MONTH' as test data for the interval
field, however I keep running into syntax errors near the closing
parenthesis near the fieldname.
I have also tried
SELECT
interval:='INTERVAL 1 MONTH';
SELECT DATE_ADD(NOW(),
interval) AS date;
and
SELECT
interval:='1 MONTH';
SELECT DATE_ADD(NOW(),INTERVAL
interval) as date;
but all yield roughly the same result
I even tried some string functions (like CONCAT()). Does anyone have any
other ways that I might be able to acheive the same result (remembering
that the interval has to be an arbitrary value).
Thanks in advance
Adam
--
/----------------------------------------------------------------------\
|Adam Carmichael, A+, 2xMCP (Windows 2000), Cert IV Helpdesk Admin |
|adamc
no1.com.au /( _,-----,_ )\ _| |_ /,|| |
|#1 Computer Services \`/ \'/ _| |_ || |
|BSD/UNIX Network Engineer \ /o\ /o\ / | | _||_ |
\----------------------------------------------------------------------/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]