Re: SQL question

From: Sanjeev Agrawal <sanju_at_grok119.ColumbiaSC.NCR.COM>
Date: Tue, 8 Feb 1994 14:07:02 GMT
Message-ID: <CKwsJq.HD9_at_ncrcae.ColumbiaSC.NCR.COM>


In article <2j28p1$5ii_at_spock.dis.cccd.edu> paulk_at_uhura.dis.cccd.edu (Paul Krikorian) writes:
>I know some simple SQL, but I'm not sure how to go about doing the following.
>
>I have three tables from which I would like to extract certain related
>columns of data into one row. The link between the first two tables will
>always be there, but the link between the second and third table may not.
>However, I would still like to return all the columns from the first and
>second tables regardless of whether or not the link between table two and
>three exists. How do I go about doing this? I've tried the follwing, but
>it will not return a row if the link between table two and three is missing.
>
>SELECT T1.a, T2.b, T3.c
> FROM tbl_1 T1, tbl_2 T2, tbl_3 T3
> WHERE T1.a = T2.a AND T2.b = T3.b
>
Give it a try:

SELECT T1.a, T2.b, T3.c
  FROM tbl_1 T1, tbl_2 T2, tbl_3 T3
 WHERE T1.a = T2.a
   AND T2.b = T3.b(+)

And if possible go thru the OUTER JOINS.

luck !

>Any help would be greatly appreciated!
>
>Thanks in advance.
>
>--
>Paul Krikorian | Internet: paulk_at_uhura.dis.cccd.edu
>Coast Community College District | (or paulk_at_cccd.edu)
>1370 Adams Ave. | Voice: (714) 432-5150
>Costa Mesa, CA 92626, USA | Fax: (714) 432-5062

-- 
*-------------------------------------------------------------------------*
|  Sanjeev Kumar Agrawal              sanju_at_grok119.columbiaSC.NCR.COM    |
|  AT&T Global Information Solutions  Phone: (803) 939-6835 (W)           |
|  3325 Platt Springs Road                         791-9048 (H)           |
Received on Tue Feb 08 1994 - 15:07:02 CET

Original text of this message