Ambiguous Column within Sub Select Query
750523Feb 17 2010 — edited Feb 17 2010I am getting an 'ambiguous column' error when I query using a sub select. Here is my query:
select *
from (select
c.custody_id,
c.person_id,
n.first_name,
n.last_name,
z.usms_number,
c.start_date,
c.end_date,
c.district_office_id,
cbc.custody_id,
c.update_date,
c.update_user_id
from custody c,
custody_booking_pkg_components cbc,
z_migrate_usms_number z,
district_office do,
district d,
person p,
name n
where
c.person_id = p.person_id and
z.person_id = p.person_id and
z.ordinal = 1 and
c.custody_id = cbc.custody_id(+) and
p.name_id = n.name_id and
do.district_id = d.district_id and
c.district_office_id = do.district_office_id and
d.district_id = 99 order by c.update_date desc)
where rownum <= 10;
I understand why a 'ambiguous column' error means, but I dont see which column is ambiguous. I have ran the sub select by itself and it works correctly, but when combined with the outer select it fails.