Hi Simon,

One way to solve the problem is this query:
select max(field+0) from table;
Since numeric 0 is added to field, mysql silently converts field column 
into numeric first and makes the calculation accordingly.

Beware that pure character strings give zero when converted to numeric type 
so if all the pertinent data of your table are less than zero you will get 
0 as the result.

Anvar.
.
At 08:44 AM 22/10/2001 +0200, Kraa de Simon wrote:
>Hello all,
>
>How can I find the highest integer value in a result set like:
>
>1
>10
>11
>2
>3
>a
>ab
>abc
>
>I'm looking for the value 11.
>
>The statement 'select max(field) from table' gives me 'abc' so this won't
>do.
>
>Any ideas for a SQL statement that will do the trick?
>
>I'm using PHP / MySQL.
>
>Thanks!
>
>Simon.
>
>---------------------------------------------------------------------
>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


---------------------------------------------------------------------
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

Reply via email to