Re: Format an Update with calculation - Mailing list pgsql-general

From Andrew Gierth
Subject Re: Format an Update with calculation
Date
Msg-id 87pntzvtip.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Format an Update with calculation  (Bret Stern <bret_stern@machinemanagement.com>)
List pgsql-general
>>>>> "Bret" == Bret Stern <bret_stern@machinemanagement.com> writes:

 Bret> My statement below updates the pricing no problem, but I want it
 Bret> to be formatted with 2 dec points eg (43.23).

UPDATE ...
   SET suggested_retail_price = round(suggested_retail_price*1.13, 2)
 WHERE ...

assuming suggested_retail_price is already of type "numeric".

You could also have given the columm a type of numeric(18,2) or similar,
which would round all assigned values to 2 places.

-- 
Andrew (irc:RhodiumToad)


pgsql-general by date:

Previous
From: Chris Mair
Date:
Subject: Re: How to insert bulk data with libpq in C?
Next
From: Adrian Klaver
Date:
Subject: Re: Format an Update with calculation