From roy@SiliconTao.com Mon Jun 27 17:17:03 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D710552863 for ; Mon, 27 Jun 2005 14:17:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55480-09 for ; Mon, 27 Jun 2005 17:17:00 +0000 (GMT) Received: from priv-edtnes57.telusplanet.net (outbound01.telus.net [199.185.220.220]) by svr1.postgresql.org (Postfix) with ESMTP id 1B9D952835 for ; Mon, 27 Jun 2005 14:16:58 -0300 (ADT) Received: from UtopiaPlanetia ([142.179.175.123]) by priv-edtnes57.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20050627171659.NSMQ17932.priv-edtnes57.telusplanet.net@UtopiaPlanetia> for ; Mon, 27 Jun 2005 11:16:59 -0600 Subject: How can I simply substatue a value in a query? From: Roy Souther Reply-To: Roy Souther To: pgsql-sql@postgresql.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-okNovf7BY9qZNhQuSmrc" Organization: Silicon Tao Technology Systems Inc. Date: Mon, 27 Jun 2005 11:16:58 -0600 Message-Id: <1119892618.7882.4.camel@UtopiaPlanetia> Mime-Version: 1.0 X-Mailer: Evolution 2.0.1-1mdk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.098 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/313 X-Sequence-Number: 21914 --=-okNovf7BY9qZNhQuSmrc Content-Type: multipart/alternative; boundary="=-a1CATaEQZAaABRgTDvZe" --=-a1CATaEQZAaABRgTDvZe Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I want to do a simple substatution of a value in a query. For example I have a boolean field that wil return t or f for True and False. I would like it to return Yes or No. I don't want to have a 2x2 table to look up the output. I don't want to use stored procedue. I think there is a better way, somthing very simple but I cannot remember what it is. Roy Souther www.SiliconTao.com Let Open Source help your business move beyond. For security this message is digitally authenticated by GnuPG. --=-a1CATaEQZAaABRgTDvZe Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable I want to do a simple substatution of a value in a query. For example I hav= e a boolean field that wil return t or f for True and False. I would like i= t to return Yes or No. I don't want to have a 2x2 table to look up the outp= ut. I don't want to use stored procedue.

I think there is a better way, somthing very simple but I cannot remember w= hat it is.

Roy Souther
www.SiliconTao.com
Let Open Source help your business move beyond.

For security this message is digitally authenticated by GnuPG.



--=-a1CATaEQZAaABRgTDvZe-- --=-okNovf7BY9qZNhQuSmrc Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBCwDSIY62fql08qicRAolbAKCOkGYILN2Bkay77yBglkfbeOvTKwCePEDl p2PIvuvGydOX7O6Y5bQlxQU= =ymW1 -----END PGP SIGNATURE----- --=-okNovf7BY9qZNhQuSmrc-- From sdavis2@mail.nih.gov Mon Jun 27 17:32:15 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 349685284D for ; Mon, 27 Jun 2005 14:32:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58904-06 for ; Mon, 27 Jun 2005 17:31:39 +0000 (GMT) Received: from mx5.net.nih.gov (mx5.net.nih.gov [165.112.130.36]) by svr1.postgresql.org (Postfix) with ESMTP id 539FB52833 for ; Mon, 27 Jun 2005 14:31:38 -0300 (ADT) Received: from mx5.net.nih.gov (localhost [127.0.0.1]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j5RHVaZ3006157 for ; Mon, 27 Jun 2005 13:31:38 -0400 Received: from WATSON (vpn-165-112-10-134.net.nih.gov [165.112.10.134]) by mx5.net.nih.gov (8.12.10/8.11.6) with SMTP id j5RHVYlZ006135; Mon, 27 Jun 2005 13:31:35 -0400 Message-ID: <001401c57b3e$12b5f2b0$5179f345@WATSON> From: "Sean Davis" To: "Roy Souther" , References: <1119892618.7882.4.camel@UtopiaPlanetia> Subject: Re: How can I simply substatue a value in a query? Date: Mon, 27 Jun 2005 13:31:37 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0011_01C57B1C.8B580770" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.182 tagged_above=0 required=5 tests=AWL, HTML_60_70, HTML_MESSAGE, HTML_TAG_EXIST_TBODY X-Spam-Level: X-Archive-Number: 200506/315 X-Sequence-Number: 21916 This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C57B1C.8B580770 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: Roy Souther=20 To: pgsql-sql@postgresql.org=20 Sent: Monday, June 27, 2005 1:16 PM Subject: [SQL] How can I simply substatue a value in a query? I want to do a simple substatution of a value in a query. For example = I have a boolean field that wil return t or f for True and False. I = would like it to return Yes or No. I don't want to have a 2x2 table to = look up the output. I don't want to use stored procedue. I think there is a better way, somthing very simple but I cannot = remember what it is. =20 See CASE: http://www.postgresql.org/docs/8.0/interactive/functions-conditional.html= #AEN12006 Sean ------=_NextPart_000_0011_01C57B1C.8B580770 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable =EF=BB=BF
 
----- Original Message -----
From:=20 Roy = Souther=20
Sent: Monday, June 27, 2005 = 1:16 PM
Subject: [SQL] How can I simply = substatue=20 a value in a query?

I want to do a simple substatution of a value in a = query. For=20 example I have a boolean field that wil return t or f for True and = False. I=20 would like it to return Yes or No. I don't want to have a 2x2 table to = look up=20 the output. I don't want to use stored procedue.

I think there = is a=20 better way, somthing very simple but I cannot remember what it is.
 
 
See CASE:
http://www.postgresql.org/docs/8.0/interactive/functio= ns-conditional.html#AEN12006
 
Sean
 
------=_NextPart_000_0011_01C57B1C.8B580770-- From jim@contactbda.com Mon Jun 27 17:35:12 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F1C9152867 for ; Mon, 27 Jun 2005 14:35:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58555-05 for ; Mon, 27 Jun 2005 17:35:09 +0000 (GMT) Received: from amanda.contactbda.com (ipn36372-e65122.cidr.lightship.net [216.204.66.226]) by svr1.postgresql.org (Postfix) with ESMTP id 363915281F for ; Mon, 27 Jun 2005 14:35:08 -0300 (ADT) Received: from amanda.contactbda.com (amanda.contactbda.com [192.168.1.2]) by amanda.contactbda.com (8.12.11/8.12.11/Debian-3) with ESMTP id j5RHZ7CA011382; Mon, 27 Jun 2005 13:35:07 -0400 From: "Jim Buttafuoco" To: Roy Souther , pgsql-sql@postgresql.org Reply-To: jim@contactbda.com Subject: Re: How can I simply substatue a value in a query? Date: Mon, 27 Jun 2005 13:35:07 -0400 Message-Id: <20050627173415.M31195@contactbda.com> In-Reply-To: <1119892618.7882.4.camel@UtopiaPlanetia> References: <1119892618.7882.4.camel@UtopiaPlanetia> X-Mailer: Open WebMail 2.41 20040926 X-OriginatingIP: 192.168.1.1 (jim) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/316 X-Sequence-Number: 21917 try case for example select case when bool_column then 'Yes' else 'No end from your_table; ---------- Original Message ----------- From: Roy Souther To: pgsql-sql@postgresql.org Sent: Mon, 27 Jun 2005 11:16:58 -0600 Subject: [SQL] How can I simply substatue a value in a query? > I want to do a simple substatution of a value in a query. For example I > have a boolean field that wil return t or f for True and False. I would > like it to return Yes or No. I don't want to have a 2x2 table to look up > the output. I don't want to use stored procedue. > > I think there is a better way, somthing very simple but I cannot > remember what it is. > > Roy Souther > www.SiliconTao.com > Let Open Source help your business move beyond. > > For security this message is digitally authenticated by GnuPG. ------- End of Original Message ------- From bryan.encina@valleypres.org Mon Jun 27 17:45:30 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 386A652806 for ; Mon, 27 Jun 2005 14:45:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62220-06 for ; Mon, 27 Jun 2005 17:45:21 +0000 (GMT) Received: from mail.valleypres.org (mail.valleypres.org [63.196.151.90]) by svr1.postgresql.org (Postfix) with ESMTP id 163DE52913 for ; Mon, 27 Jun 2005 14:45:20 -0300 (ADT) Received: from valleypres.org (mail.valleypres.org [172.16.12.253]) by mail.valleypres.org (Postfix) with ESMTP id 3F0199365B; Mon, 27 Jun 2005 10:45:20 -0700 (PDT) Received: from [172.16.55.141] (helo=AT10111) by valleypres.org with smtp (Exim 3.13 #3) id 1Dmxfc-0005th-00; Mon, 27 Jun 2005 10:45:20 -0700 Reply-To: From: "Bryan Encina" To: "'Roy Souther'" , Subject: Re: How can I simply substatue a value in a query? Date: Mon, 27 Jun 2005 10:45:36 -0700 Message-ID: <00ab01c57b40$07425c00$8d3710ac@AT10111> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <1119892618.7882.4.camel@UtopiaPlanetia> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/317 X-Sequence-Number: 21918 -----Original Message----- From: pgsql-sql-owner@postgresql.org = [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Roy Souther Sent: Monday, June 27, 2005 10:17 AM To: pgsql-sql@postgresql.org Subject: [SQL] How can I simply substatue a value in a query? I want to do a simple substatution of a value in a query. For example I = have a boolean field that wil return t or f for True and False. I would = like it to return Yes or No. I don't want to have a 2x2 table to look up = the output. I don't want to use stored procedue. I think there is a better way, somthing very simple but I cannot = remember what it is. ------------- I think a CASE statement is what you want. Check the Conditional = Expressions section of the docs at: http://www.postgresql.org/docs/8.0/interactive/functions-conditional.html= HTH, Bryan Encina From site.webmaster@email.it Mon Jun 27 18:18:21 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3FB23528D5 for ; Mon, 27 Jun 2005 15:18:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68967-06 for ; Mon, 27 Jun 2005 18:18:18 +0000 (GMT) Received: from mailout01.albacom.net (mailout01.albacom.net [217.220.34.13]) by svr1.postgresql.org (Postfix) with SMTP id 7DBCA52949 for ; Mon, 27 Jun 2005 15:18:14 -0300 (ADT) Received: (qmail 947 invoked by uid 508); 27 Jun 2005 18:18:05 -0000 Received: from site.webmaster@email.it by mailout01.albacom.net with qmail-scanner (rbl: ???. spamassassin: ???. Clear:RC:1(217.221.167.198):RBL:0:SA:0(0.0/1000.0):. Processed in 0.400954 secs); 27 Jun 2005 18:18:05 -0000 Received: from unknown (HELO ?127.0.0.1?) (davide@attutta.albaweb.it@217.221.167.198) by mailout01.albacom.net with SMTP; 27 Jun 2005 18:18:04 -0000 Message-ID: <42C042DA.8040809@email.it> Date: Mon, 27 Jun 2005 20:18:02 +0200 From: davide User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: bryan.encina@valleypres.org, pgsql-sql@postgresql.org Subject: Re: How can I simply substatue a value in a query? References: <00ab01c57b40$07425c00$8d3710ac@AT10111> In-Reply-To: <00ab01c57b40$07425c00$8d3710ac@AT10111> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.032 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200506/318 X-Sequence-Number: 21919 Bryan Encina wrote: >-----Original Message----- >From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Roy Souther >Sent: Monday, June 27, 2005 10:17 AM >To: pgsql-sql@postgresql.org >Subject: [SQL] How can I simply substatue a value in a query? > > >I want to do a simple substatution of a value in a query. For example I have a boolean field that wil return t or f for True and False. I would like it to return Yes or No. I don't want to have a 2x2 table to look up the output. I don't want to use stored procedue. > >I think there is a better way, somthing very simple but I cannot remember what it is. > >------------- > >I think a CASE statement is what you want. Check the Conditional Expressions section of the docs at: >http://www.postgresql.org/docs/8.0/interactive/functions-conditional.html >HTH, >Bryan Encina > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > > select case "field" when 'T' then 'Yes' when 'F' then 'No' else null end from ...