I have a DATETIME column, indexed, which I store both a date and time in, as expected. However, I often want to select all rows for a given date, regardless of time.
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' I can also use the >= and <= and both appear to work the same (however, 20021117 and 20021118 still don't work in 4.0.5-beta-max as noted in an earlier bug). My primary question, is if there is a way to "mask" the time part out, so I can do a straight comparison: ... WHERE TO_DATE(thecolumn) = '2002-11-17' while maintaining the advantage of the DATETIME index (ie, not DATE_FORMAT() and doing a string comparison). Maybe a TIMESTAMP column would be better; although I'd think that DATETIME would be proper here. Any insight into the "best way" to do this (ie paying attention to only the date part of DATETIME during a straight comparison, while using the advantages of a fast numeric index), or any alternatives, would be greatly appreciated. Thank you, ===== Hans Zaunere New York PHP http://nyphp.org [EMAIL PROTECTED] --------------------------------------------------------------------- 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