pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: davide <site.webmaster@email.it>
To: bryan.encina@valleypres.org
To: pgsql-sql@postgresql.org
Subject: Re: How can I simply substatue a value in a query?
Date: Mon, 27 Jun 2005 20:18:02 +0200
Message-ID: <42C042DA.8040809@email.it> (raw)
In-Reply-To: <00ab01c57b40$07425c00$8d3710ac@AT10111>
References: <00ab01c57b40$07425c00$8d3710ac@AT10111>

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





view thread (5+ messages)

Message-ID: <42C042DA.8040809@email.it>
Permalink:  ../42C042DA.8040809@email.it/
Also on:    postgresql.org/message-id/42C042DA.8040809@email.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: site.webmaster@email.it, bryan.encina@valleypres.org
  Subject: Re: How can I simply substatue a value in a query?
  In-Reply-To: <42C042DA.8040809@email.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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