Hi I have a database whose table has a column, which has a datatype longtext. I then try a query
mysql> select MY_DATE from my_table where MLC_DATE between '09/22/2003' AND '10/21/2 003';
I thought it would fail since the datatype isnt DATE nor TIMESTAMP. But from the result, it seems to work.
1) Is this query reliable ?
No. You're doing a string comparison with the sort parts (year, month, day) not listed in that order in the comparison values.
2) What possible scenarios where comparing the string dates would go wrong ? 3) Is there a way to convert all the strings in a database table eg 09/22/2003 in each row in the database to 2003-09-22 in each row in the database
You can use LEFT(), MID(), RIGHT() to bust up the strings into pieces, and CONCAT() to put them back together.
-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com
Are you MySQL certified? http://www.mysql.com/certification/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]