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
> > How about select max(floor(field)) from table ?
> >
> > TK
>
> Good idea, but...
>
> Using floor produces the following error:
>
> Warning: SQL error: [MERANT][ODBC PROGRESS driver][PROGRESS]Invalid number
> string (7498), SQL state S1000 in SQLExecDirect in c:\program
> files\nusphere\apac
How about select max(floor(field)) from table ?
TK
> -Opprinnelig melding-
> Fra: Kraa de Simon [mailto:[EMAIL PROTECTED]]
> Sendt: 22. oktober 2001 08:44
> Til: Php-General (E-mail); MySQL (E-mail)
> Emne: Max int value of char field? How to find...
>
>
> Hello
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!
Si