[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)

-- 
Oliver Elphick                                [EMAIL PROTECTED]
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "For God shall bring every work into judgment, 
      with every secret thing, whether it be good, or  
      whether it be evil."               Ecclesiastes 12:14 


Reply via email to