From: | davide <site(dot)webmaster(at)email(dot)it> |
---|---|
To: | bryan(dot)encina(at)valleypres(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How can I simply substatue a value in a query? |
Date: | 2005-06-27 18:18:02 |
Message-ID: | 42C042DA.8040809@email.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Bryan Encina wrote:
>-----Original Message-----
>From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Roy Souther
>Sent: Monday, June 27, 2005 10:17 AM
>To: pgsql-sql(at)postgresql(dot)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 ...
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Bertheau | 2005-06-27 18:41:37 | Re: SELECT * FROM foo OFFSET -1 LIMIT 1 |
Previous Message | Bryan Encina | 2005-06-27 17:45:36 | Re: How can I simply substatue a value in a query? |