X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9741A30DC60 for ; Wed, 18 Jun 2003 19:14:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03739-10 for ; Wed, 18 Jun 2003 16:13:52 -0300 (ADT) Received: from web20806.mail.yahoo.com (web20806.mail.yahoo.com [216.136.226.195]) by svr1.postgresql.org (Postfix) with SMTP id 319D630D6D2 for ; Wed, 18 Jun 2003 16:13:50 -0300 (ADT) Message-ID: <20030618191349.45141.qmail@web20806.mail.yahoo.com> Received: from [208.13.35.65] by web20806.mail.yahoo.com via HTTP; Wed, 18 Jun 2003 12:13:49 PDT Date: Wed, 18 Jun 2003 12:13:49 -0700 (PDT) From: Jeff Eckermann Subject: Re: set decimal point in SQL To: rodgerd@diaspora.gen.nz, pgsql-sql@postgresql.org In-Reply-To: <20030618190216.GA549@diaspora.gen.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200306/224 X-Sequence-Number: 13982 --- Rodger Donaldson 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