List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 12 2011 6:06pm
Subject:Re: operation with dates
View as plain text  
In the last episode (May 12), Rocio Gomez Escribano said:
> I found it, 
> 
> mysql> select userID from user where datediff(now(), userPaymentDate)< 365;

This can be made more readable by using mysql's INTERVAL syntax.  It can
also be made more efficient by moving userPaymentDate out of the function,
so if you have an index on that column mysql can use it:

select userID from user where userPaymentDate > (now() - interval 1 year)

-- 
	Dan Nelson
	dnelson@stripped
Thread
operation with datesRocio Gomez Escribano12 May
Re: operation with datesAndrew Moore12 May
  • RE: operation with datesRocio Gomez Escribano12 May
    • Re: operation with datesDan Nelson12 May
      • Re: operation with dateshsv13 May
        • Re: operation with datesDan Nelson13 May
          • Re: operation with dateshsv14 May