Re: Rounding result of expression in SELECT ..AS..

Поиск
Список
Период
Сортировка
От Jean-Yves F. Barbier
Тема Re: Rounding result of expression in SELECT ..AS..
Дата
Msg-id 20111215144720.5ba2740a@anubis.defcon1
обсуждение исходный текст
Ответ на Rounding result of expression in SELECT ..AS..  (Michael Rowan <mike.rowan@internode.on.net>)
Список pgsql-novice
On Fri, 16 Dec 2011 00:06:54 +1030
Michael Rowan <mike.rowan@internode.on.net> wrote:


> 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?

SELECT TRUNC(myBioutifuelCalcul, NbOfDecimalsWanted);

--
Falling in love makes smoking pot all day look like the ultimate in
restraint. -- Dave Sim, author of "Cerebus".

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

Предыдущее
От: Michael Rowan
Дата:
Сообщение: Rounding result of expression in SELECT ..AS..
Следующее
От: Jayadevan M
Дата:
Сообщение: Re: Rounding result of expression in SELECT ..AS..