> From: Matt W [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 10, 2003 5:47 PM
> To: Erik Osterman; [EMAIL PROTECTED]

> No, Roger's method can't use an index. :-) But yes, using WHERE is
> better than HAVING.

Ah... right indeed. In this case it wouldn't work. My mistake... :) 

> To get the WHERE to use an index, don't use a function in the
> comparison:

Though you can use functions on indexed columns so long as you (generally)
aren't using table columns which lie in your domain. 

E.g. FROM_UNIXTIME(1068520546) or NOW() will use indexes, but
FROM_UNIXTIME(col) will not -- since col is in your input domain. Unless
we're talking about MIN/MAX functions and those are an exception!

So for clarification, David, those functions that do operate on indexed
columns will only work in WHERE clauses and not work in HAVING clauses.




Thanks for the correction,


Erik Osterman
http://osterman.com/






-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to