> > 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\apache\htdocs\mantist\cus\test.php on line 4
> 
> Warning: Supplied argument is not a valid ODBC result resource in 
> c:\program
> files\nusphere\apache\htdocs\mantist\cus\test.php on line 5
> 1
> 

It works on normal MySQL connections, I wonder why the ODBC can't handle it...  One of 
the following queries may work better for you, but I must warn you that finding the 
max integer value of a char field is far from efficient...

SELECT MAX(FLOOR(field)) FROM table WHERE field RLIKE "^[0-9]+$"
SELECT MAX(LPAD(field, 10, "0") FROM table WHERE field RLIKE "^[0-9]+$"

Steve Meyers



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