I am using simple order by clause to show products according to available quantity
Below is the query I am using:
SELECT * FROM productsinfo ORDER BY quantity desc
Query giving no error but sorting order is not correct.Anyone please tell me where I am wrong.
EDIT
Have checked my quentity clumn is varchar type.I am storing values in 1,215 10,456 format.
Might be your quantity column is
varchartype so it’s not sorting as numbers.Please check.You need to cast it in integer type
Try below:
OR Use below trick.