Re: sorting of a price field

Поиск
Список
Период
Сортировка
От vinayak
Тема Re: sorting of a price field
Дата
Msg-id 1379313963507-5771033.post@n5.nabble.com
обсуждение исходный текст
Ответ на sorting of a price field  (Anne Wainwright <anotheranne@fables.co.za>)
Список pgsql-novice
>I run a fairly simple query to show current records of stock using the
>phrase 'sort by shop_price'.
>Surprise (but really no surprise) this is sorted in ascii order rather
>than shop_price order. So 110.00 comes before 20.00
>I can't see any reference to changing this. What can I do, is this
>perhaps to do with the field type, can it be changed?


may be data type of shop_price is text so you can either type cast it in
below way or alter table and change the data type as numeric(if it is not
violating any other constraints).

select * from table_name order by shop_price::numeric;




-----
Thanks and Regards,
Vinayak Pokale,
NTT DATA OSS Center Pune, India
--
View this message in context: http://postgresql.1045698.n5.nabble.com/sorting-of-a-price-field-tp5770849p5771033.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


В списке pgsql-novice по дате отправления:

Предыдущее
От: Lonni J Friedman
Дата:
Сообщение: Re: cannot do backup - locked?
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: PostgreSQL 9.3 Error when trying to run Create Extension postgis