Rounding result of expression in SELECT ..AS..

Поиск
Список
Период
Сортировка
От Michael Rowan
Тема Rounding result of expression in SELECT ..AS..
Дата
Msg-id C3C0596E-4466-4BB8-9A3F-7FE6DD543DF9@internode.on.net
обсуждение исходный текст
Ответы Re: Rounding result of expression in SELECT ..AS..  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
Re: Rounding result of expression in SELECT ..AS..  (Jayadevan M <Jayadevan.Maymala@ibsplc.com>)
Список pgsql-novice
I have three columns in my table:
netcost integer(9,2)
taxsum integer(9,2)
quantity integer

In my SELECT I have:

SELECT (netcost+taxsum)*quantity AS totalcost FROM etc etc

My problem is that the value in totalcost is, like, 49.500000000000

SELECT round((netcost+taxsum)*quantity, 2) AS totalcost FROM etc etc

gives the same result.   What I want is 2DP, ie 49.50 in this example.  Is there a way to achieve this?

TIA and for past help.


Michael Rowan
mike.rowan@internode.on.net

11 Kingscote Street
ALBERTON
South Australia 5014

tel 618 8240 3993




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

Предыдущее
От: Pushpendra Singh Thakur
Дата:
Сообщение: Re: Help with installing pgAdmin 3
Следующее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Rounding result of expression in SELECT ..AS..