View Single Post
Old 09-22-2004, 09:41 AM  
aiken
Confirmed User
 
Join Date: Jun 2003
Location: Kona, HI
Posts: 204
Your query isn't using the index because you're making MySQL convert the datetime field to a varchar, and then that against the "like" operator.

What you want is probably something like "where date_live>='2004-09-22' and date_live<'2004-09-23'", and then let your app deal with displaying only the date. (In this approach, the constants will be converted from char to datetime before the comparisons, as opposed to the "like" example where for all MySQL knows you're examining the fourth character, so it has to convert all of the dates to chars)

At least, that's my guess. I'm an MS SQL guy

Cheers
-b
__________________
ICQ: 12005327

Last edited by aiken; 09-22-2004 at 09:43 AM..
aiken is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote