Hi Rob,
Rob Desbois wrote:
I am having issues with type conversion not working as expected per the
documentation.
I am using in MySQL 5.0.27 for x86/Windows.
The documentation at
http://dev.mysql.com/doc/refman/5.0/en/type-conversion.html states that for
comparison operators "If one of the arguments is a TIMESTAMP or
DATETIMEcolumn and the other argument is a constant, the constant is
converted to a
timestamp before the comparison is performed."
So the following SQL statement should convert the last string to a
timestamp
then perform date-time comparison:
SELECT '2007-05-24 00:00:00' BETWEEN
('2007-3-23' - INTERVAL 24 HOUR) AND '2007-3-23 23:59:59';
Thus it should return 0 as 24th May is not in the given range. I get the
result 1 however...
If I perform an explicit conversion using CAST('2007-3-23 23:59:59' AS
DATETIME) I get 0 as expected.
Can anyone enlighten me - have I misunderstood something somewhere?
Thanks,
No, I think the problem is the conversion when using BETWEEN is not clearly documented.
Here is more on that:
http://www.xaprb.com/blog/2006/09/12/type-conversion-semantics-of-mysqls-between-operator/
Baron
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]