SQL: max() and min() return strange values
Posted: Mon Mar 13, 2006 2:16 pm
[PROBLEMS]
I wanted to get the maximum and minimum values of a field containing numbers in an SQL database, but when I did a
I received very strange results:
the maximum was: -9.2718491
and the minimum was -0.372839
Apart from being upside down, there were values in that table ranging downto -17.
[SOLUTION]
The "value" field was a VARCHAR and not a numeric type.
I wanted to get the maximum and minimum values of a field containing numbers in an SQL database, but when I did a
Code: Select all
SELECT max(value) FROM myTable
the maximum was: -9.2718491
and the minimum was -0.372839
Apart from being upside down, there were values in that table ranging downto -17.
[SOLUTION]
The "value" field was a VARCHAR and not a numeric type.