I have run into this same problem a couple of times. Since I cant outer join on a subquery, is there some way to work around it? For example something like:
select e.last_name, r.address, r.address_seq
from
employees e, residences r
where e.emp_id=r.emp_id
and r.address_seq = (select max(address_seq) from residences r2 where e.emp_id=r2.emp_id)
in this case we use address_seq to identify the most recent address on file. The problem occurs when the target has no residences on file. Normally I would outer join at "r.address_seq =" to get all records, but Oracle does not allow an outer join here.
Can anybody give me any suggestions how to work around this kind of problem?
thanks in advance
select e.last_name, r.address, r.address_seq
from
employees e, residences r
where e.emp_id=r.emp_id
and r.address_seq = (select max(address_seq) from residences r2 where e.emp_id=r2.emp_id)
in this case we use address_seq to identify the most recent address on file. The problem occurs when the target has no residences on file. Normally I would outer join at "r.address_seq =" to get all records, but Oracle does not allow an outer join here.
Can anybody give me any suggestions how to work around this kind of problem?
thanks in advance