pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: rodgerd@diaspora.gen.nz
To: pgsql-sql@postgresql.org
Subject: Re: set decimal point in SQL
Date: Wed, 18 Jun 2003 12:13:49 -0700 (PDT)
Message-ID: <20030618191349.45141.qmail@web20806.mail.yahoo.com> (raw)
In-Reply-To: <20030618190216.GA549@diaspora.gen.nz>

--- Rodger Donaldson <rodgerd@diaspora.gen.nz> wrote:
> On Mon, Jun 16, 2003 at 05:02:34PM -0500, Bu, Ning
> wrote:
> 
> > I have a field set up as money and I try to
> calculate some number
> > and put in this field, but the number will be 6
> demical point and I
> > want to cut it to only 2-4 decimal point, how can
> I do it? Thanks
> 
> round(); eg
> 
> select	round(foo, 2)
> from	bar
> 
> ...will give you values in column foo rounded to 2
> decimal places.
> 

If you use "numeric(x,2)", where x is the largest
number of digits you are likely to need, the rounding
will be done for you.  Type "money" is deprecated
anyway, and is likely to be dropped in a future
release.  You can format the numeric value on output
if you want to display currency symbols or whatever.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



view thread (3+ messages)

Message-ID: <20030618191349.45141.qmail@web20806.mail.yahoo.com>
Permalink:  ../20030618191349.45141.qmail@web20806.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030618191349.45141.qmail@web20806.mail.yahoo.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff_eckermann@yahoo.com, rodgerd@diaspora.gen.nz
  Subject: Re: set decimal point in SQL
  In-Reply-To: <20030618191349.45141.qmail@web20806.mail.yahoo.com>

* 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