User Variable and DATE_ADD Function

Hi,

I have a query that uses a user variable to get the latest date from a
table using the MAX function. I then need to add 1 month onto this
date using DATE_ADD but the query just returns a NULL for the second
field.

Here's my query:

SELECT
CheckId,
#This displays correctly
[at] lastchecked:=MAX(CheckedDate),

#This just returns (NULL)
DATE_ADD( [at] lastchecked,INTERVAL 1 MONTH ) as lastcheckedplus1month
FROM
checkingtable
GROUP BY
CheckId

Has anyone managed to use DATE_ADD with a user variable? Can you tell
me if I'm missing something?

Any help is greatly appreciated.

Thank you,

Peter.
Peter Redding [ Fr, 09 Februar 2007 17:28 ] [ ID #1624185 ]
Datenbanken » mailing.database.mysql » User Variable and DATE_ADD Function

Vorheriges Thema: MySQL Slow Log ERROR
Nächstes Thema: Importing with phpMyAdmin