On Tuesday 04 Dec 2001 14:58, Emil Rasmussen wrote:
> > SELECT count(id)
> > FROM tblTabel
> > WHERE fieldName != '' AND
> > (
> > myDateField >= 20011120000000 AND
> > myDateField < 20011130000000
> > );
>
> Thank you, that was defiantly part of the solution!
>
> I had created an index on both fieldName og myDateField, but MySQL did not
> use that. But creating an index only on myDateField did the trick.

If you don't search on the first field in the index, the index doesn't get 
used. In a majority of cases, what you want is a separate index for each 
field. There are exceptions, of course, for example when you want to create 
unique constraints on a table...

> Thanks for the help!

Any time.

Gordan

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to