Re: Format an Update with calculation

2018-12-19 Thread Ken Tanzer
On Tue, Dec 18, 2018 at 5:51 AM Adrian Klaver wrote: > 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 > > exampl

Re: Format an Update with calculation

2018-12-19 Thread Ron
On 12/19/2018 02:12 AM, Condor wrote: On 18-12-2018 15:51, Adrian Klaver wrote: [snip] In addition to what Pavel posted: select round(43.2335, 2);  round ---  43.23 Beware with round and numeric select round(43.2375, 2);  round ---  43.24  select 43.2375::numeric(17, 2);  numeri

Re: Format an Update with calculation

2018-12-19 Thread Condor
On 18-12-2018 15:51, Adrian Klaver wrote: 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

Re: Format an Update with calculation

2018-12-18 Thread Ron
Bret, That's just an example of how to use Postgres' cast syntax.  You'd write: UPDATE im_ci_item_transfer    SET suggested_retail_price=(suggested_retail_price + (suggested_retail_price * .13))::numeric(7,2) WHERE item_code='0025881P2'; I prefer the round() function, though. On 12/18/2018 0

Re: Format an Update with calculation

2018-12-18 Thread Bret Stern
Thanks again, I don't remember ever using a select in an update. Not sure how to use a select in an update, I'll google around. On Tue, 2018-12-18 at 08:18 +0100, Pavel Stehule wrote: > > > > út 18. 12. 2018 v 8:15 odesílatel Bret Stern > napsal: > > My statement below updates the pr

Re: Format an Update with calculation

2018-12-18 Thread Adrian Klaver
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 b

Re: Format an Update with calculation

2018-12-18 Thread Andrew Gierth
> "Bret" == Bret Stern 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

Re: Format an Update with calculation

2018-12-17 Thread Pavel Stehule
út 18. 12. 2018 v 8:15 odesílatel Bret Stern < bret_st...@machinemanagement.com> napsal: > 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 i