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: Newbie SQL query

Re: Newbie SQL query

From: Alan <alan_at_erols.com>
Date: Wed, 23 Jun 2004 09:13:04 -0400
Message-ID: <2jtdujF15sshlU1@uni-berlin.de>


Look up OUTER JOIN.

"P B" <pbeliveau_at_avior.ca> wrote in message news:muuid0l4et7rc00nso8n1mfpq65cvrhtue_at_4ax.com...
> If I have those two tables
>
> TABLE_1: PRIMARY_KEY
> DATA_1_1
> DATA_1_2
> ...
>
> TABLE_2: PRIMARY_KEY_1 referencing TABLE_1.PRIMARY_KEY
> PRIMARY_KEY_2
> DATA_2_1
> DATA_2_2
> ...
>
> I want to make a query which will give me:
>
> T1.PRIMARY_KEY T1.DATA_1_1 T1.DATA_1_2 T2.PRIMARY_KEY_2 T2.DATA_2_1
> T2.DATA_2_2
>
> if I do :
>
> select T1.PRIMARY_KEY, T1.DATA_1_1, T1.DATA_1_2, T2.PRIMARY_KEY_2,
> T2.DATA_2_1, T2.DATA_2_2 from TABLE_1 T1, TABLE_2 T2 where
> T1.PRIMARY_KEY=T2.PRIMARY_KEY_1;
>
> It DONT work FULLY because row in TABLE_2 are not mandatory. So the
> query only give me result line for which I have data in TABLE_1 and
> corresponding data in TABLE_2
>
> How should I make my query to show TABLE_1 data even if there no
> corresponding data in TABLE_2 ?
>
> Thanks
Received on Wed Jun 23 2004 - 08:13:04 CDT

Original text of this message

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