Re: numeric sorting on a char field having a decimal
Posted in 2006
Topics: General Discussion
Jaini wrote: > Hi, > > In Informix, I have a char(6) column in which decimals are stored. I > need to sort in the numeric order. I have seen couple of query posted > before which deals with numeric stored in a char field but I'm looking > for decimals stored in the char. > > I need the o/p in following format - > > 10.1 > 10.2 > 10.3 > 10.10 > 10.22 > 10.29 > 10.4 > > Thanks & Regards > Abhinav > select ltrim(numberfield)... order by 1; Art S. Kagel
Art S. Kagel said select ltrim(numberfield)... order by 1; I don't think that is quite right because if I do that I get this: 10.5 10.5 10.50 10.50 7.11 7.23 7.24 7.29 7.34 7.4 7.40 7.45 7.5 8.11 8.23 8.24 8.29 8.34 8.4 8.40 8.45 8.5 Of course if the data has no number over 9.9999 then your way does work.