sql,query

At 8:53 -0500 11/22/02, Nicholas Elliott wrote:
So essentially, you want to put an index on part of the column, and not the
whole column, right? As in, an index on just the date part, and not the time
part. (Or both -- it seems like you want it to do both at the same time).
Much like you can with a char column -- put a char on the first 2 letters,
so that you can return all columns that have those first two letters the
same.
Index prefixes may be applied only to string columns.  What you suggest
won't work for a DATETIME column.

So... can you change the DATETIME column to a char[14] column, and then put
an index on the first 8 characters (representing your date)?  That seems to
be what you're looking for -- because then you could search for just the
date (the first 8 characters) and it would be a direct ref to all the times
under that date.

Or am I completely off base here =]

Nick Elliott
That would work, although of course then you lose the advantages of
storing values as DATETIMEs.

---------------------------------------------------------------------
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