Re: Format an Update with calculation

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: bret_stern(at)machinemanagement(dot)com, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Format an Update with calculation
Date: 2018-12-18 13:51:16
Message-ID: 9c8f99cc-241e-531a-0474-7956d6f718b8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-12-18 13:53:21 Re: IF NOT EXIST
Previous Message Andrew Gierth 2018-12-18 13:49:55 Re: Format an Update with calculation