Click to See Complete Forum and Search --> : Having problem with join


bduke
02-20-2003, 03:29 PM
select a.xxx,b.yyy from table1 a, table2 b
where a.xxx(+) = b.yyy;


The result I want is to pick up all the entries in table1 a even if it doesn't match with table2

stecal
02-20-2003, 04:09 PM
Note the order of the where clause tables:

SQL> select * from xxx;

ID LOCATION
---------- ----------
1 AAAA
2 BBB
3 BBBB
4 DDDD

SQL> select * from yyy;

ID LOCATION
---------- ----------
1 AAAA
2 BBB

SQL> select a.id, a.location
2 from xxx a, yyy b
3 where b.id = a.id (+);

ID LOCATION
---------- ----------
1 AAAA
2 BBB

SQL> select a.id, a.location
2 from xxx a, yyy b
3 where a.id = b.id (+);

ID LOCATION
---------- ----------
1 AAAA
2 BBB
3 BBBB
4 DDDD

bduke
02-20-2003, 05:12 PM
Thanks - Great Job