Have you considered NOT comparing dates as strings but rather as date 
values?  That will avoid the use of CONCAT() completely.


SELECT * 
FROM sampletable
WHERE datefield >= '1999-01-12' and datefield <'1999-02-01'

This example query will get all of the records from sampletable that were 
entered after January 11th and before February 1st. It will also be 
**very** fast if the column "datefield" is indexed.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Alfredo Cole <[EMAIL PROTECTED]> wrote on 10/11/2004 09:43:14 AM:

> Hi:
> 
> I have a problem in that all statements that include concat execute very 

> slowly. For instance, if I have three fields in string format  that 
represent 
> a year, month and day, and want to issue a select like:
> 
> select * from cxcmanpag where contact 
> (year,month,day)<=stringYear+stringMonth+stringDay (simplified), then it 
will 
> take a long time, againts a table with only around 100,00 records. If I 
> rewrite the statement to read:
> 
> select * from cxcmanpag where year<=stringYear and month<=stringMonth 
and 
> day<=stringDay, it will execute considerable faster, but will not 
produce the 
> same results.
> 
> I have looked in the manual, and also read High Performance MySQL 
> from Zawodny 
> and Balling, and MySQL from Paul Dubois, but none of them seem to 
address 
> this issue.
> 
> Can somebody point me to a URL or book that I should be reading to 
improve, 
> this, or how to avoid using concat altogether?
> 
> Thank you.
> 
> -- 
> Alfredo J. Cole
> Grupo ACyC
> www.acyc.com - www.clshonduras.com - SolCom
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to