SQL Language (MOSC)

MOSC Banner

Left outer join

edited Dec 17, 2013 5:55PM in SQL Language (MOSC) 5 commentsAnswered ✓
Hi,I have a problem with a left join on the same table.
This is just a sample of my table with 3 rows:

select * from test1

custno    custno2    type    code
------    -------    ----    ----
191737    68640    108    102
191737    35045    146    112
191737    42529    153    112

I want to do a left join on the same table.
The join is on "custno" and "code".


So my query is

select i.custno, i.custno2, j.custno2 subcustnum
from test1 i
left outer join test1 j on (i.custno=j.custno and i.code=j.code and i.type =153 and j.type !=153)
order by i.custno, i.custno2


and the result is :

custno    custno2    subcustnum

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center