Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

oracle joins

experts... This looks like a simple question. I have 2 tables with oid as the common key.
If I want to get the records from table a which have a match with table b plus the records from table a which does not have a match with table b, how do I query that?

for ex: table a has the records
oid       name    
1          aaa                    
2          bbb
3          ccc
4          ddd
5          eee

and table b has the columns

oid      name   value
1          aaa     101
2          bbb      102

I want the output like

oid           name          value
1              aaa            101
2              bbb             102
3              ccc          
4              ddd
5             eee
0
chickanna
Asked:
chickanna
1 Solution
 
johnsoneSenior Oracle DBACommented:
Is this what you are looking for?
select a.oid, a.name, b.value
from tablea a left outer join tableb b
on a.oid = b.oid;

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now