celestine
05-11-2005, 09:43 AM
I have a field 'zip' in a table in my database that records values in the form on 'something/023/something', 'anything/346/somemore','kztt/1984/asdg'
I want to get the min and max values of this field in particular the numbers in the string. Initially, I simply run a query to get the min and max value of this field which works until the numbers in the string went to 4-digits instead of the usual 3.
Example query: select min(zip) as min, max(zip) as max from $dbtable
Then I run an explode function to retrieve the numbers in the string.
This query now return values like min=999, max=1000 instead, when the min number should be 023 and max is 1984
Can someone point me to the right direction? Thanks so much.
I want to get the min and max values of this field in particular the numbers in the string. Initially, I simply run a query to get the min and max value of this field which works until the numbers in the string went to 4-digits instead of the usual 3.
Example query: select min(zip) as min, max(zip) as max from $dbtable
Then I run an explode function to retrieve the numbers in the string.
This query now return values like min=999, max=1000 instead, when the min number should be 023 and max is 1984
Can someone point me to the right direction? Thanks so much.