Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to create a query that displ

Status
Not open for further replies.

zgx

MIS
Oct 24, 2002
1
US
I need to create a query that displays all rows in the master table (Table.M). A secondary table (Table.S) contains additional values that must be appended if there is a match.

For example:

Table.M columns

PK, columns....

1, joe,33,44,
2, mary,12,89
3, mike,22,9


Table.S columns

1, JJ
3, KK
4, LL

Output


1, joe,33,44, JJ
2, mary,12,89, (null - OK. no value in Table.S)
3, mike,22,9,KK

For some reason, I only display rows where both keys match.

Thank in advance!

JP

 
In Oracle

Select M.Pk, M.cola, M.colb, M.colc, S.cola from M, S where M.pk = S.pk (+)

the (+) signifys an outer join, where it is permissible for S.Pk to be null I tried to remain child-like, all I acheived was childish.
 
oracle, schmoracle, this is the ansi sql forum B-)

Code:
select stuff
  from M
left outer
  join S
    on M.pk = S.pk

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top