-
Sql query question
Not sure if this is the right place to post this but here goes....
I've got a field in my mysql db that contains both alpha and numeric values.
I'm trying to find the highest numeric value but using the below returns an alpha value.
Can I add a where clause so it only finds the max value of the numeric values in the field?
PHP Code:
SELECT MAX(MyField) AS MaxValue FROM MyTable
-
Re: Sql query question
post an example of your data, the entire row would be nice. 6x6x6x6, 9999ABz? Max() should return the highest ASCII value. It depends on your data as to how you want to do this?
-
Re: Sql query question
You can cast the data to a numeric type, but that will only work if the number is at the beginning of the string. Like suggested above, you need to post an example of the formatof your data.