How to query order to asc (or desc) when column format is varchar-Collection of common programming errors
I have a table product(ID, name, quanlity)
with quanlity is varchar(55)
With my data
1 | Iphone 3 | 7
2 | Iphone 3S | 8
3 | Iphone 4 | 79
4 | Iphone 4S | 9
5 | Iphone 5 | 10
And my query:
Select * From product order by quanlity DESC
But result can’t order quanlity, because quanlity is varchar, How to query sort exactly
4 | Iphone 4S | 9
2 | Iphone 3S | 8
3 | Iphone 4 | 79
1 | Iphone 3 | 7
5 | Iphone 5 | 10