Keith C. Ivey wrote:

On 1 Dec 2003 at 13:41, Kevin Carlson wrote:



Does MySQL support formatted indexes such as in the statement below?

alter table DateInfo add index monthYear (DATE_FORMAT(updateDate,
'%m/%Y'))



What sort of queries would that help you with?...



This helps with queries where you want to get all of the records where a date column value falls within a specific month and year. For example:


select * from DateInfo where DATE_FORMAT(updateDate, '%m/%Y') = '03/2003'

I have an index on the updateDate column but it does not seem to be used since I am altering the value with the DATE_FORMAT function in the where clause. Using 'explain' it becomes obvious that no index is being used to build the result set.

I hope that makes things more clear. Any ideas?


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to