pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: bret_stern@machinemanagement.com
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Format an Update with calculation
Date: Tue, 18 Dec 2018 05:51:16 -0800
Message-ID: <9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.com> (raw)
In-Reply-To: <1545117297.4397.18.camel@dell990-bret-centos.localdomain>
References: <1545117297.4397.18.camel@dell990-bret-centos.localdomain>

On 12/17/18 11:14 PM, Bret Stern wrote:
> My statement below updates the pricing no problem, but I want it to be
> formatted with 2 dec points eg (43.23).
> 
> Started playing with to_numeric but can't figure it out. Lots of 
> examples with to_char in the
> manual, but still searching for answer.
> 
> Can it be done?
> 
> I want suggested_retail_price to be formatted to 2 decimal points
> 
> UPDATE im_ci_item_transfer
>     SET suggested_retail_price=(suggested_retail_price + 
> (suggested_retail_price * .13))
> WHERE item_code='0025881P2';
> 
> Feeling lazy, sorry guys

In addition to what Pavel posted:

select round(43.2335, 2);

  round
-------
  43.23




-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (9+ messages)  latest in thread

Message-ID: <9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.com>
Permalink:  ../9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.com/
Also on:    postgresql.org/message-id/9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.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 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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, bret_stern@machinemanagement.com
  Subject: Re: Format an Update with calculation
  In-Reply-To: <9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.com>
  References: <1545117297.4397.18.camel@dell990-bret-centos.localdomain> <9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.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