Solved

oracle joins

Posted on 2011-03-24
1
221 Views
Last Modified: 2012-05-11
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
Comment
Question by:chickanna
1 Comment
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 35210403
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now