Categories
How to extract the maximum value from a text field in MySql?
id | value 1 | 3 2 | 24 3 | -5 4 | 2 5 | 2006 | 99 SELECT MAX(value) FROM `test` Gives 99, but should be 200
SELECT MAX(value) FROM `test`
Answer the question
In order to leave comments, you need to log in
Try it like this:SELECT MAX(CAST(value AS UNSIGNED)) FROM `test`
SELECT MAX(CAST(value AS UNSIGNED)) FROM `test`
200 > 99 '99' > '200'
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question