Re: Format an Update with calculation

Поиск
Список
Период
Сортировка
Искать
От
Pavel Stehule
Тема
Re: Format an Update with calculation
Дата
Msg-id
CAFj8pRD76ZjhYe5fAFv4iVC+vCJ4QE8jnrcd2ygUmnDZzcEkng@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Format an Update with calculation Bret Stern <bret_stern@machinemanagement.com>
Re: Format an Update with calculation Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Format an Update with calculation Adrian Klaver <adrian.klaver@aklaver.com>
Re: Format an Update with calculation Condor <condor@stz-bg.com>
Re: Format an Update with calculation Ron <ronljohnsonjr@gmail.com>
Re: Format an Update with calculation Ken Tanzer <ken.tanzer@gmail.com>
Re: Format an Update with calculation Pavel Stehule <pavel.stehule@gmail.com>
Re: Format an Update with calculation Bret Stern <bret_stern@machinemanagement.com>
Re: Format an Update with calculation Ron <ronljohnsonjr@gmail.com>


út 18. 12. 2018 v 8:15 odesílatel Bret Stern <bret_stern@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 in the
manual, but still searching for answer.

Can it be done?

postgres=# select random();
┌───────────────────┐
│      random       │
╞═══════════════════╡
│ 0.261391982901841 │
└───────────────────┘
(1 row)

postgres=# select random()::numeric(7,2);
┌────────┐
│ random │
╞════════╡
│   0.67 │
└────────┘
(1 row)


 
Regards

Pavel


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
В списке pgsql-general по дате отправления
От: Bret Stern
Дата:
От: Alban Hertroys
Дата:
Сообщение: Re: IF NOT EXIST
FAQ