Brian Dunning wrote:
> Thanks Peter, that appears to be exactly what I'm looking for, but it
> still gives an error and I've been through it with a fine-toothed comb,
> tried different versions, parens, etc. Here is the exact SQL statement
> I'm using, with your suggestion:
>
> select
> accounts.username,
> meets.id as meet_id,
> DATEDIFF( DATE_ADD( meets.creation, INTERVAL 30 DAY), NOW() ) as
> expire_days
> from
> meets
> left join
> accounts on meets.id=accounts.id
> ....blah blah blah lots more stuff.
>
> And here is the exact error I get:
>
> 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 '(
> DATE_ADD( meets.creation, INTERVAL 30 DAY), NOW() ) as expire
>
> Can anyone see the problem? I sure can't.
>
DATEDIFF was added in 4.1.1. What version of mysql do you have?
<http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html>
Michael