Re: How to trim values?

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: How to trim values?
Дата
Msg-id Pine.LNX.3.96.1001230113338.19982D-100000@ara.zf.jcu.cz
обсуждение исходный текст
Ответ на Re: How to trim values?  ("Oliver Elphick" <olly@lfix.co.uk>)
Список pgsql-sql
On Thu, 28 Dec 2000, Oliver Elphick wrote:

> jkakar@expressus.com wrote:
>   >Hi,
>   >
>   >I'm trying to figure out how to take a value like 3.68009074974387
>   >(that is calculated from values in my database) and have PostgreSQL
>   >hand me 3.68.  Any suggestions would be appreciated.
> 
> cast it to numeric(x,2)
> 
> (where x is the total number of digits, and 2 is two decimal places).
> 
> template1=# select  3.68009074974387::numeric(3,2);
>  ?column? 
> ----------
>      3.68
> (1 row)
> 
> or use round(value,2)
> 
> 
> template1=# select round(3.68009074974387, 2);
>  round 
> -------
>   3.68
> (1 row)

or

test=# select to_char(3.68009074974387, '99.99');to_char
---------  3.68
(1 row)
        Karel



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

Предыдущее
От: John Reid
Дата:
Сообщение: Re: system catalog info
Следующее
От: Kaare Rasmussen
Дата:
Сообщение: Re: Date/Time problem -(((