pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL 9.2.4 - please assist with the query
4+ messages / 2 participants
[nested] [flat]

* PostgreSQL 9.2.4 - please assist with the query
@ 2015-01-23 08:19 Khangelani Gama <kgama@argility.com>
  2015-01-23 08:45 ` Re: PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Khangelani Gama @ 2015-01-23 08:19 UTC (permalink / raw)
  To: pgsql-admin

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 ……..



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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 9.2.4 - please assist with the query
  2015-01-23 08:19 PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
@ 2015-01-23 08:45 ` Khangelani Gama <kgama@argility.com>
  2015-01-23 08:46   ` Re: PostgreSQL 9.2.4 - please assist with the query Shabangu, Nicholus <nicholus.shabangu@ebucks.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Khangelani Gama @ 2015-01-23 08:45 UTC (permalink / raw)
  To: Shabangu, Nicholus <nicholus.shabangu@ebucks.com>; pgsql-admin

Thank you …I 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 = 71008 then ‘71007’

else  x

 end

 from table......









SELECT * FROM test;



a

---

1

2

3





SELECT a,

       CASE WHEN a=1 THEN 'one'

            WHEN a=2 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 ……..



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 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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 9.2.4 - please assist with the query
  2015-01-23 08:19 PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
  2015-01-23 08:45 ` Re: PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
@ 2015-01-23 08:46   ` Shabangu, Nicholus <nicholus.shabangu@ebucks.com>
  2015-01-23 08:54     ` Re: PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Shabangu, Nicholus @ 2015-01-23 08:46 UTC (permalink / raw)
  To: Khangelani Gama <kgama@argility.com>; pgsql-admin

You can remove the single quotes if it’s not text

From: Khangelani Gama [mailto:kgama@argility.com]
Sent: 23 January 2015 10:45 AM
To: Shabangu, Nicholus; pgsql-admin@postgresql.org
Subject: RE: [ADMIN] PostgreSQL 9.2.4 - please assist with the query

Thank you …I will try it

From: Shabangu, Nicholus [mailto:nicholus.shabangu@ebucks.com<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 = 71008 then ‘71007’
else  x
 end
 from table......




SELECT * FROM test;

a
---
1
2
3


SELECT a,
       CASE WHEN a=1 THEN 'one'
            WHEN a=2 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> [mailto: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<mailto: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 ……..

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<mailto: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 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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PostgreSQL 9.2.4 - please assist with the query
  2015-01-23 08:19 PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
  2015-01-23 08:45 ` Re: PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
  2015-01-23 08:46   ` Re: PostgreSQL 9.2.4 - please assist with the query Shabangu, Nicholus <nicholus.shabangu@ebucks.com>
@ 2015-01-23 08:54     ` Khangelani Gama <kgama@argility.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Khangelani Gama @ 2015-01-23 08:54 UTC (permalink / raw)
  To: Shabangu, Nicholus <nicholus.shabangu@ebucks.com>; pgsql-admin

Thank You very much, it works



*From:* Shabangu, Nicholus [mailto:nicholus.shabangu@ebucks.com]
*Sent:* 23 January 2015 10:46 AM
*To:* Khangelani Gama; pgsql-admin@postgresql.org
*Subject:* RE: [ADMIN] PostgreSQL 9.2.4 - please assist with the query



You can remove the single quotes if it’s not text



*From:* Khangelani Gama [mailto:kgama@argility.com]
*Sent:* 23 January 2015 10:45 AM
*To:* Shabangu, Nicholus; pgsql-admin@postgresql.org
*Subject:* RE: [ADMIN] PostgreSQL 9.2.4 - please assist with the query



Thank you …I 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 = 71008 then ‘71007’

else  x

 end

 from table......









SELECT * FROM test;



a

---

1

2

3





SELECT a,

       CASE WHEN a=1 THEN 'one'

            WHEN a=2 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 ……..



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
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 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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-01-23 08:54 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 08:19 PostgreSQL 9.2.4 - please assist with the query Khangelani Gama <kgama@argility.com>
2015-01-23 08:45 ` Khangelani Gama <kgama@argility.com>
2015-01-23 08:46   ` Shabangu, Nicholus <nicholus.shabangu@ebucks.com>
2015-01-23 08:54     ` Khangelani Gama <kgama@argility.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox