List:General Discussion« Previous MessageNext Message »
From:Michael Stassen Date:January 6 2006 5:38am
Subject:Re: Getting # of days until expiration
View as plain text  
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


Thread
Getting # of days until expirationBrian Dunning6 Jan
  • Re: Getting # of days until expirationScott Haneda6 Jan
  • Re: Getting # of days until expirationPeter Brawley6 Jan
    • Re: Getting # of days until expirationBrian Dunning6 Jan
      • Re: Getting # of days until expirationMichael Stassen6 Jan
        • Re: Getting # of days until expirationBrian Dunning7 Jan
          • Re: Getting # of days until expirationJake Peavy8 Jan