SQL CASE Statements

From: "Lane Van Ingen" <lvaningen(at)esncc(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: SQL CASE Statements
Date: 2005-08-19 01:31:34
Message-ID: EKEMKEFLOMKDDLIALABIOEIOCBAA.lvaningen@esncc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In the following CASE statement, is it possible to put a SELECT ... WHERE
EXISTS
in the <condition> of a CASE statement, and have it work?

The <condition> I want to do is to yield a result of '1' if the statement
finds
the value 'a' in a table (EXISTS evaluates true), and '0' if it evaluates
false
('a' not found).

SELECT a,
CASE WHEN <CONDITION> THEN 1
ELSE 0
END

Has anybody done this? If so, can you send me a sample?

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitri Bichko 2005-08-19 01:56:17 Re: SQL CASE Statements
Previous Message Ferindo Middleton Jr 2005-08-18 23:36:48 Re: How to secure PostgreSQL Data for distribute?