--- "Keith C. Ivey" <keith@stripped> wrote:
> On 21 Nov 2002, at 14:38, Hans Zaunere wrote:
>
> > I've played around with a couple different methods, but the only way I
> can
> > see to use the INDEX (according to EXPLAIN) is doing a query along the
> > lines of:
> >
> > ... WHERE thecolumn BETWEEN '2002-11-17' AND '2002-11-18'
>
> You don't explain what you don't like about using that method. If it
> works, why are you still searching?
Because it seems ineffncient to me, as MySQL must be doing more work to
calculate the range. Even EXPLAIN tells me this, by showing that a
less-than-optimal TYPE is being used. Although "WHERE thecolumn =
'2002-11-17'" doesn't yield any results, EXPLAIN shows that it's using a
better index type.
> If the problem is that you don't want to have to calculate the next
> date, then use
>
> ... WHERE thecolumn BETWEEN '2002-11-17 00:00:00' AND
> '2002-11-17 23:59:59'
This is so much the problem, as I can easily pass what I want to via the host
language, but yes, it's just another reason why a straight comparison would
be nice.
=====
Hans Zaunere
New York PHP
http://nyphp.org
hans@stripped