Re: A newbie question on SQL...

From: Patrick Ryan <pat_at_chinook.halcyon.com>
Date: 15 Feb 1995 20:11:07 GMT
Message-ID: <3htn4r$6q4_at_news1.halcyon.com>


I think the UNION functionality will do what you want. Check it out in the SQL*PLUS users's guide and reference manual under "UNION". Be sure to use the primary key of table B in your select against the table.

-Pat

Chung Ley (chung.ley_at_amd.com) wrote:
: Hi,
 

: I have 3 tables: Table A, Table B, and Table C.
 

: Table A is my master table; Table B is the detail and Table C
: is just attribute data....
 

: For each record in Table A, there may or may not be any records in
: Table B. I was trying to run a outer-join query, and if there are
: record(s) in Table B, I want to use the most recent one:
 

: My query looks like this:
 

: select a.column1, a.column2, b.column1, b.column2,
: c.full_name
: from TableA a, TableB b, TableC c
: where a.key1 (+)= b.key1
: and a.key2 (+)= b.key2
: and b.latest_flag = 'Y'
: and b.userid = c.userid;
 

: Well, it didn't work like I expected.... It basically gives
: back results only when there is matching keys in TableA and
: TableB. I would like me to give me null values for b.column1,
: b.column2 and c.full_name if there is no matching records in
: TableB...
 

: Thanks a million in advance.
 

: --cley
Received on Wed Feb 15 1995 - 21:11:07 CET

Original text of this message