Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZWxn-0005KS-Ba for pgsql-general@arkaria.postgresql.org; Wed, 19 Dec 2018 08:12:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gZWxk-0003KG-Uj for pgsql-general@arkaria.postgresql.org; Wed, 19 Dec 2018 08:12:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZWxk-0003K9-F1 for pgsql-general@lists.postgresql.org; Wed, 19 Dec 2018 08:12:16 +0000 Received: from stz-bg.com ([2a02:6800:0:99::2] helo=mail.stzbg.com) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gZWxc-0004mm-8b for pgsql-general@postgresql.org; Wed, 19 Dec 2018 08:12:14 +0000 Received: from www.stz-bg.com (stz-bg.com [IPv6:2a02:6800:0:99::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: condor@stz-bg.com) by mail.stzbg.com (Postfix) with ESMTPSA id 7D4C02E0F64; Wed, 19 Dec 2018 10:12:04 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stz-bg.com; s=mail; t=1545207124; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=URXewJmwKtpdEJftYClCSwe+RGSvKwKplwLFuIKLtGA=; b=lMW6eXnFv38uXQb3o7R7FC6Ch0o96DCZwifbjkUex5EBHotqqx/4+lgj271oBFbVCUox7L tFFGzt7EU4Qr1iXyz+CXOeh3JD6xk4QE7+McLt8knnEteO1O9Z03UnfCGUDHACJqfMO5ZE 3FoBQAT0SsUtvMTPySWIUjH+szxKVJ8= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Wed, 19 Dec 2018 10:12:04 +0200 From: Condor To: Adrian Klaver Cc: bret_stern@machinemanagement.com, pgsql-general 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> Message-ID: <85cdf83ed6473eb48dc1a66c44f55c61@stz-bg.com> X-Sender: condor@stz-bg.com User-Agent: Roundcube Webmail/1.3.8 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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). >>=20 >> Started playing with to_numeric but can't figure it out. Lots of=20 >> examples with to_char in the >> manual, but still searching for answer. >>=20 >> Can it be done? >>=20 >> I want suggested_retail_price to be formatted to 2 decimal points >>=20 >> UPDATE im_ci_item_transfer >> =C2=A0=C2=A0 SET suggested_retail_price=3D(suggested_retail_price +=20 >> (suggested_retail_price * .13)) >> WHERE item_code=3D'0025881P2'; >>=20 >> Feeling lazy, sorry guys >=20 > In addition to what Pavel posted: >=20 > select round(43.2335, 2); >=20 > round > ------- > 43.23 Beware with round and numeric select round(43.2375, 2); round ------- 43.24 select 43.2375::numeric(17, 2); numeric --------- 43.24 Regards, HS