Re: How to trim values? - Mailing list pgsql-sql

From Karel Zak
Subject Re: How to trim values?
Date
Msg-id Pine.LNX.3.96.1001230113338.19982D-100000@ara.zf.jcu.cz
Whole thread Raw
In response to Re: How to trim values?  ("Oliver Elphick" <olly@lfix.co.uk>)
List 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 by date:

Previous
From: John Reid
Date:
Subject: Re: system catalog info
Next
From: Kaare Rasmussen
Date:
Subject: Re: Date/Time problem -(((