Sub-Select in CASE

From: "Brian C(dot) Doyle" <bcdoyle(at)mindspring(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Sub-Select in CASE
Date: 2002-04-01 17:47:30
Message-ID: 5.1.0.14.2.20020401124436.02aaf1c0@proxy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello all,

I am trying to run a query that checks to see if a mail box exist in a
db. If the mail box does not exist i need it to return another address.

Currently I am working with :

SELECT CASE WHEN alias.mbox='brian' THEN alias.email_add ELSE (SELECT
alias.email_add WHERE alias.mbox='*' AND alias.domain='domain.com) END
WHERE alias.domain='domain.com' and alias.mbox='brian';

I am not even sure if Case is the best choice.

More background info on it, this is for and db that EXIM enter acts with
and i want to be able to setup a default alias.

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Langille 2002-04-02 00:36:17 selecting records from a date range
Previous Message Marin Dimitrov 2002-04-01 17:35:17 Re: Statistics