Re: help in making the query to use the index

2002-08-27 Thread Gerald Clark
your date strings are incorrect. As a string it should be '2002-08-01' but it can also be treated as a numeric. try: and expendituredate between 20020801 and 20020831 kamesh jayachandran wrote: >Hi Gerald, >I tried the following query, >select DATE_FORMAT(expendituredate,"%d-%b-%Y") as expdate,

RE: help in making the query to use the index

2002-08-27 Thread kamesh jayachandran
Hi Gerald, I tried the following query, select DATE_FORMAT(expendituredate,"%d-%b-%Y") as expdate,sum(amount) as amount from expenditure where userid=11 and expendituredate between '2002-8-01' and '2002-8-31' group by expendituredate order by expendituredate; which is not overriding the expend

Re: help in making the query to use the index

2002-08-27 Thread Gerald Clark
Your query overloads expendituredate. Mysql now has to scqan the whole table to see if the new expenditure date will meet the where clause ( which it never will ) try DATE_FORMAT(expendituredate,"%F=%b-%Y) as expdate and see what happens. kamesh jayachandran wrote: >Hi all, >I have a table na

help in making the query to use the index

2002-08-26 Thread kamesh jayachandran
Hi all, I have a table named expenditure whose create statement is as follows, expenditure | CREATE TABLE `expenditure` ( `expenditureid` int(11) unsigned NOT NULL auto_increment, `expendituredate` date NOT NULL default '-00-00', `artifactid` smallint(5) unsigned NOT NULL default '0',