>From the manual :

 MIN() and MAX() may take a string argument; in such cases they return
the minimum or maximum string value.

so I understand that for a timestamp column, values are converted and
then compared as strings, then the function return a string, so adding
+ 0 convert it to a number (which is different from adding 0 to a
timestamp). MIN/MAX operating on timestamp would have been more
straightforward, no ?
Or is there anything to coerce a string into a timestamp ? (appart a format )



On Wed, 16 Mar 2005 15:40:26 -0600, gerald_clark
<[EMAIL PROTECTED]> wrote:
> Mister Jack wrote:
> 
> >It returns :
> >
> >select max(timestamp) as timestamp from news;
> >+---------------------+
> >| timestamp           |
> >+---------------------+
> >| 2005-03-14 19:49:20 |
> >+---------------------+
> >
> >
> The string shown above converted into a number is 2005.
> ( Unless you think ist should be 1988 )
> Add 0, and it is still 2005.
> 
> >and also :
> >
> >select timestamp as timestamp from news limit 1;
> >+---------------------+
> >| timestamp           |
> >+---------------------+
> >| 2002-03-25 19:45:32 |
> >+---------------------+
> >
> >so If I do :
> >
> >select timestamp + 0 as timestamp from news limit 1;
> >+----------------+
> >| timestamp      |
> >+----------------+
> >| 20020325194532 |
> >+----------------+
> >
> >So i would expect a "max(timestamp) + 0" to work the same than without the 
> >max.
> >
> >is this a bug ?
> >
> >(the code rely heavily on a result as a timestamp(14), like
> >YYYYMMDDHHmmss,  so getting this work helps migrating from 4.0 to 4.1)
> >thanks for your help
> >
> >
> >
> >
> 
>

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

Reply via email to