OK.. I have a field named 'adate' which is a mysql auto timestamp. I
need to use this data to do many time functions on a large 160,000 or so
row database. I have indexed adate, but am having trouble with this
WHERE statement because I am unable to make clean use of the index. I
have to do everything I can to get this to run as fast as possible.

to get today - YYYYMMDDHHMMSS <= 364 (to return all entries this year) I
run

WHERE TO_DAYS(NOW()) - TO_DAYS(adate) <= 364 

or  

TO_DAYS(adate) >= TO_DAYS(NOW()) - 364

to get TO_DAYS(YYYYMMDDHHMMSS) = today I run

WHERE TO_DAYS(adate) = TO_DAYS(NOW())

I simply cannot figure a way to get adate outside of the TO_DAYS()
function.

BTW, I am collecting a 14 char timestamp as in another location I will
need to pull the time to the second.

Perhaps I simply need to add another field to deal with this part of the
date stuff?

-- 
John Hinton - Goshen, VA.
http://www.ew3d.com

Those who dance are considered insane 
by those who can't hear the music....

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