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
        dnel...@allantgroup.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to