Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Outer join problem

Re: Outer join problem

From: Pierre Charpenay <pcharpenay_at_unilog.fr>
Date: Wed, 09 Feb 2000 13:30:50 +0100
Message-ID: <38A15DFA.89E8F842@unilog.fr>


Hi,

What you want is :

Some rows of A who have a description (from B) AND
Some rows of A who have no description

That's typically a UNION, so try this :

SELECT a.seqid, b.description, a.numerical_column from a, b
where a.catid=b.catid /* have a description in B */ and a.seqid='12345'
UNION
SELECT a.seqid, 'NO DESC.' description, a.numerical_column from a, b
where a.seqid='12345'
 and not exists (select null from b /* have no description in B */

                         where b.catid=a.catid)
order by 2

--
 Pierre CHARPENAY Received on Wed Feb 09 2000 - 06:30:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US