Left outer join
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
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
0