Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YEZrj-00074A-U8 for pgsql-admin@arkaria.postgresql.org; Fri, 23 Jan 2015 08:45:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YEZrj-0003tG-7f for pgsql-admin@arkaria.postgresql.org; Fri, 23 Jan 2015 08:45:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YEZrh-0003sk-TP for pgsql-admin@postgresql.org; Fri, 23 Jan 2015 08:45:18 +0000 Received: from eu1sys200aog118.obsmtp.com ([207.126.144.145]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YEZrc-0000NJ-EJ for pgsql-admin@postgresql.org; Fri, 23 Jan 2015 08:45:16 +0000 Received: from mail-we0-f171.google.com ([74.125.82.171]) (using TLSv1) by eu1sys200aob118.postini.com ([207.126.147.11]) with SMTP ID DSNKVMIKFqo7bSxN8z+noseRHkDY30E+LA6s@postini.com; Fri, 23 Jan 2015 08:45:12 UTC Received: by mail-we0-f171.google.com with SMTP id q58so6255364wes.2 for ; Fri, 23 Jan 2015 00:45:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:content-type; bh=cSisLjZ/uZyGFSlPTqfpQ+nAkYlUWzA9x6+cKD6e338=; b=Px4hYPVkUq5H+MSXJIDojht6xVk6lvl8q4cySA21Ip/bHsF8F0iO17K4uoVq1vWqrr X+7+X+++bCN90VjUK2hY7EmUuSLf0IjRfLcdkFyPCpVHEDPR8TRMLwHfpE3z+YkDwguu x8g7hIIE+RQYXj87DOOGgeIe/06H476aTVyjksBCBp4iIsvwNMLX7QtLHtvu3CoD2Fgm 3Mss32OtqgHFquQUmj1B2H01s41iU8rS8bNtXJqNnJgJURqt/jN9XbIZMWWmM/rff/e+ H5U/vcMJYezrb69eATSDjtbe/3v+oNEI2Lorw9GO4OivJNdv3VXluZTsemowOs3tC17w O4lw== X-Gm-Message-State: ALoCoQmDPb+o9g/QuvtpE7c78ONodzBsSs2KYnfnWsxoeeCY9DyLEyIHuQp0slGFu4WxuE7G533PBYMrSJzpwibv4nFOx/x0TzcGHIdEP75bLphhtHYyglExkIfY91Z7ySjxctz4v1ogGYbcF3y/NZfFmd5qoh6O1A== X-Received: by 10.180.108.165 with SMTP id hl5mr1366174wib.39.1422002710860; Fri, 23 Jan 2015 00:45:10 -0800 (PST) X-Received: by 10.180.108.165 with SMTP id hl5mr1366152wib.39.1422002710726; Fri, 23 Jan 2015 00:45:10 -0800 (PST) From: Khangelani Gama References: In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 thread-index: AQDQPhK/kgemgu4bGcJShpYJ0PfcGgE/JnEVnsNcDKA= Date: Fri, 23 Jan 2015 10:45:08 +0200 Message-ID: Subject: Re: PostgreSQL 9.2.4 - please assist with the query To: "Shabangu, Nicholus" , pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=e89a8f3ba101715cf7050d4dce55 X-Pg-Spam-Score: -2.8 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --e89a8f3ba101715cf7050d4dce55 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you =E2=80=A6I will try it *From:* Shabangu, Nicholus [mailto:nicholus.shabangu@ebucks.com] *Sent:* 23 January 2015 10:42 AM *To:* Khangelani Gama *Subject:* RE: [ADMIN] PostgreSQL 9.2.4 - please assist with the query I think you are looking for something like this select x, case when x =3D 71008 then =E2=80=9871007=E2=80=99 else x end from table...... SELECT * FROM test; a --- 1 2 3 SELECT a, CASE WHEN a=3D1 THEN 'one' WHEN a=3D2 THEN 'two' ELSE 'other' END FROM test; a | case ---+------- 1 | one 2 | two 3 | other *From:* pgsql-admin-owner@postgresql.org [mailto: pgsql-admin-owner@postgresql.org] *On Behalf Of *Khangelani Gama *Sent:* 23 January 2015 10:19 AM *To:* pgsql-admin@postgresql.org *Subject:* [ADMIN] PostgreSQL 9.2.4 - please assist with the query Hi I need help, I need to change every result with x being 71008 to be 71007 in the select query below. SELECT x, sum( value ) as value from table where =E2=80=A6=E2=80=A6.. Results will show as follows but if the query finds x as 71008 then it must make it 71007 instead. Is this possible? 71015 | 101240.00 71008 | -19351.34 CONFIDENTIALITY NOTICE The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes. To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: https://www.fnb.co.za/disclaimer.html If you are unable to access the Disclaimer, send a blank e-mail to firstrandbankdisclaimer@fnb.co.za and we will send you a copy of the Disclaimer. CONFIDENTIALITY NOTICE The contents of and attachments to this e-mail are intended for the addre= ssee only, and may contain the confidential information of Argility (Proprietary) Limited and/or its subsidiaries. An= y review, use or dissemination thereof by anyone other than the intended addressee is prohibited.If you are not the intend= ed addressee please notify the writer immediately and destroy the e-mail. Argility (Proprietary) Limited and its subsidiari= es distance themselves from and accept no liability for unauthorised use of their e-mail facilities or e-mails sent other tha= n strictly for business purposes. =0D --e89a8f3ba101715cf7050d4dce55 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Thank you =E2=80=A6I will try it

=C2=A0

From: Shabangu, Nicholus [mailto:nicholus.shabangu@ebucks.com]
Sent: 23 January 2015 10:42 = AM
To: Khangelani Gama
Subject: RE: [ADMIN] PostgreSQL = 9.2.4 - please assist with the query

=C2=A0

I thi= nk you are looking for something like this

select=C2=A0 x,

case when x =3D 71008 then =E2=80=9871007=E2=80=99

e= lse=C2=A0 x

=C2=A0end

= =C2=A0from table......

=C2=A0

=C2=A0

=C2=A0

=C2= =A0

SELECT= * FROM test;

= =C2=A0

a

---

1

2

3

=C2=A0

=C2=A0

SEL= ECT a,

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CASE WHEN a=3D1 THEN 'one'

=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WHEN a=3D2 THEN 'two'=

=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ELSE 'other'=

=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 END

=C2=A0=C2=A0=C2=A0 FROM test;

=C2=A0

a | case

---+-------

= 1 | one

2 | two

3 | other

=C2=A0

=C2=A0

=C2=A0

From: pgsql-admin-owner@postgresql.org [mailto= :pgsql-admin-owner@post= gresql.org] On Behalf Of Khangelani Gama
Sent: 23 Janu= ary 2015 10:19 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] PostgreSQL 9.2= .4 - please assist with the query

=C2=A0

Hi

=C2=A0

I need help, I need to change every result with x = being 71008 to be 71007 in the select query below.

=C2=A0

SELECT =C2=A0x, sum( value ) as value fr= om table where =E2=80=A6=E2=80=A6..

=C2=A0

Results will show as follows but if the query finds x = as 71008 then it must make it 71007 instead. Is this possible?

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0

71015 | =C2=A0101= 240.00

71008 |=C2=A0 -19351.34

=C2=A0 =C2=A0

=C2=A0

=C2=A0

=C2=A0

= =C2=A0

=C2=A0
=C2=A0
CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the =
addressee only, and may contain the confidential
information of A=
rgility (Proprietary) Limited and/or its subsidiaries. Any review, use or d=
issemination thereof by anyone
other than the intended addressee =
is prohibited.If you are not the intended addressee please notify the write=
r immediately
and destroy the e-mail. Argility (Proprietary) Limi=
ted and its subsidiaries distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent ot=
her than strictly for business purposes.
=C2=A0

To read F= irstRand Bank's Disclaimer for this email click on the following addres= s or copy into your Internet browser:
https://www.fnb.co.za/disclaimer.html


=C2=A0

If you are unable to access the Disclaimer, send a blank e-mail to firstrandbankdisclaimer@fnb.c= o.za and we will send you a copy of the Disclaimer.


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addre=
ssee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. An=
y review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intend=
ed addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiari=
es distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other tha=
n strictly for business purposes.
=0D
--e89a8f3ba101715cf7050d4dce55--