Seppo Kuusela Seppo Kuusela - 1 year ago 136
MySQL Question

MYSQL Value error

I have a database with some values, like from 0 to 1 million. However if I want to select the highest value it does not work always, like it can have lower amount first and the big number as you can see on the image.

enter image description here

I have tried

SELECT * FROM listings ORDER BY value DESC
but it does not give the highest value, also with ASC it does not give the lowest value first.

I really hope I can get help from here.

Answer Source

Here you go:

SELECT * FROM listings ORDER BY length(value) DESC, value DESC
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download