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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL statement question...

Re: SQL statement question...

From: Alan Shein <alanshein_at_erols.com>
Date: Thu, 28 Oct 1999 14:28:03 -0400
Message-ID: <7va4hr$rg4$1@autumn.news.rcn.net>


Look up "Outer Join" and/or "Left Outer Join" in your textbook. Another person has already posted the Oracle SQL for you, but be aware that each RDBMS may have a different syntax for outer joins.

>>

Hello all,

     Table AAA:
    A1 number(10);
    A2 varchar2(10);
    A3 date;

    A1           A2        A3
    -----        -----     ------
    1              A1         01-Jan-90
    2              A2         02-Jan-90

    Table BBB
    B1 number(10);
    A1 number(10);
    B2 varchar2(100);

    B1           A1        B2
    -----        -----     ------
    1              1         B1
    2              3         B2

    Results:
    A1       A2        A3                B1            B2
    -----    ------    ------------  -----          ----
    1          A1        01-Jan-90    1               B1
    2          A2        02-Jan-90
    3                                           2               B2

    How can I get the results by using one SQL statement? (i.e. retrieve all the fields of table AAA and BBB, join by A1. Also show the record content if the record is found in one table only)

Thanks.
<< Received on Thu Oct 28 1999 - 13:28:03 CDT

Original text of this message

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