At 5:46 PM +0300 9/9/01, Eyal Rif wrote:
>Hi,
>
>I have a table with the format of :
>
>char(20),int(7),char(32)
>
>the "Date char(20)" contents in actually a number(seconds since 1970) -
>
>I want to use a "select" query that will give the max value according to
>number value of that column.
>
>select @last:=MAX(Date) from stat1;
>
>What I need to know is how to convert a string to a number on a select
>statement.
Add zero to it. The first comparison below is performed in lexical
order, the second in numeric order:
mysql> SELECT '9' < '13';
+------------+
| '9' < '13' |
+------------+
| 0 |
+------------+
mysql> SELECT '9'+0 < '13'+0;
+----------------+
| '9'+0 < '13'+0 |
+----------------+
| 1 |
+----------------+
>
>Any help/reference will be appreciated
>
>Thanks,
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php