I have a situation in which I have a column name c_id which is in varchar but contains integer or null values.
(I cannot change the datatype since it is been used like this, from very long, in my project)
My problem is whenever I try to order by my table with that column, it shows me corrupted results and even when I search for the max value it doesn’t give me the max value according to its magnitude.
I wonder if it is stored in ASCII form internally, but i m not very sure.
PLease help me knowing this why this is occurring.
Thanks.
Try to use CAST function:
or