Hi, I am trying to make a call to find, and have the result set ordered. However, I am experiencing some strange behaviour. The column I want to sort on is of type varchar, but actually contains floating point numbers. (I needed to switch the type to varchar to get validation on the input working properly). So when I just try to order, it returns in what seems to be a properly ordered (in terms of strings) collection. However, I am trying to get it to return the collection sorted in terms of float values. I tried just returning the collection and then using sort_by with column.to_f, but this wasn''t working (even though when I tried it just through IRB that call to sort_by on an array of strings worked fine). Here is how the "sorted" list came out using this method: 45.418185 45.4226533 45.11111 45.333333 -75.123213 -12.12344 -12.12344 13 -99 So then I tried to implement it in the SQL query, using CAST (ie, ORDER BY CAST(column as SIGNED) ) but this is returning some strange results too. For example, here is the "sorted" output of using CAST: -99 -75.123213 -12.12344 -12.12344 13 45.333333 45.11111 45.4226533 45.418185 Does anybody have any ideas whats going on, or any other approaches that I could try to get this working? Thanks, Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---