On Thu, 28 Dec 2000, Oliver Elphick wrote:

> [EMAIL PROTECTED] 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

Reply via email to