CASE SELECT syntax

From: Marco Lazzeri <marcomail(at)noze(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: CASE SELECT syntax
Date: 2004-01-15 17:23:47
Message-ID: 1074187427.4669.114.camel@macbeth.intranet.noze.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What about a SELECT syntax like that?

SELECT
CASE WHEN bar.foo_id IS NULL THEN bar.*
ELSE foo.*
FROM foo, bar

Anyway, I need a SELECT query that gets data from a FIRST TABLE if a
specific value in a SECOND TABLE is NULL or from SECOND TABLE itself if
the value IS NOT NULL.

Any suggestion?

Thank you!
--
Marco Lazzeri [ n o z e S.r.l. ]
Via Giuntini, 25/29 - 56023 Navacchio - Cascina (PI)
Tel +39 (0)50 754380 - Fax +39 (0)50 754381
mailto:marcomail(at)noze(dot)it - http://www.noze.it

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2004-01-15 17:35:06 Re: Bytea/Large Objects/external files best practices
Previous Message Christopher Browne 2004-01-15 17:22:06 Re: PostgreSQL and MYSQL