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: david_g <david_l_gouldNOdaSPAM_at_yahoo.com.invalid>
Date: Tue, 08 Feb 2000 07:31:52 -0800
Message-ID: <1742d8f6.80a38504@usw-ex0106-048.remarq.com>


In article <38A01BF8.E52365FD_at_NOSPAMTHANX.hotmail.com>, "s. hunter" <sarahxhunter_at_NOSPAMTHANX.hotmail.com> wrote:
> Hi,
> I *know* I should be able to figure this out but my brain hurts!!!
> I have 2 tables in a database, A and B.
> Table A has columns called DistID (PK), SeqID (an FK from another
> table,
> C), CatID (FK from table B) and numerical_column.
> Table B has 2 columns: CatID (PK) and a description column.
> I thought that my query would look like this:
> SELECT a.seqid, b.description, a.numerical_column
> from a, b
> where a.catid(+)=b.catid
> and a.seqid='12345'
> order by b.description
> /
> because I want the query to return the amount in the numerical
> column as
> null if the catID isn't present in table A, together with the rest
> of
> the query results.
> Does this make sense. I was sure that an outer join should work?!
> Or do I need to use a UNION statement instead?
> Thanks,
> Sarah

try this:
SELECT a.seqid, b.description, a.numerical_column from a, b
where a.catid(+)=b.catid
and nvl(a.seqid,'12345')='12345'
order by b.description
/

Received on Tue Feb 08 2000 - 09:31:52 CST

Original text of this message

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