'Order varchar string as numeric

Is it possible to order result rows by a varchar column cast to integer in Postgres 8.3?



Solution 1:[1]

Also in case you want to order by a text column that has something convertible to float, then this does it:

select * 
from your_table
order by cast(your_text_column as double precision) desc;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eric Leschinski