For example:
you have a table named "tablename" and a field name is "price" with data type varchar
and the values are as follows
0
100
200
50.5
150.
when you write sql like "SELECT * FROM tablename ORDER BY price ASC "
you will not be getting your result as per your query, so how will you sort your data as numerically.
Here is the way to sort data as numerically when data type is varchar
select * from `tablename` order by `fieldname` + 0 ASC
No comments:
Post a Comment