From: Oliver Elphick <olly@lfix.co.uk>
To: jkakar@expressus.com
Cc: pgsql-sql@postgresql.org
Subject: Re: How to trim values?
Date: Thu, 28 Dec 2000 22:45:49 +0000
Message-ID: <200012282245.eBSMjpH02050@linda.lfix.co.uk> (raw)
In-Reply-To: <20001228140046.A13292@expressus.com>
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)
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
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 instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: olly@lfix.co.uk, jkakar@expressus.com
Subject: Re: How to trim values?
In-Reply-To: <200012282245.eBSMjpH02050@linda.lfix.co.uk>
References: <20001228140046.A13292@expressus.com> <200012282245.eBSMjpH02050@linda.lfix.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox