Question

I'm getting:

ORA-00918: column ambiguously defined 00918. 00000 - "column ambiguously defined"

Whenever I try to run:

select 
first_name as student_first_name, 
last_name as student_last_name

from super_student ss

inner join sub_distance_learning sdl
on sdl.student_id = ss.id

inner join sub_academic_tutor sat
on sat.id = sdl.academic_tutor_id

inner join super_sub_lecturer ssl
on ssl.id = sat.lecturer_id

inner join super_employee se
on se.id = ssl.employee_id;

The error only shows when this is included:

inner join super_employee se
on se.id = ssl.employee_id;

Any ideas?

Was it helpful?

Solution

Obviously, more than one table has first_name and/or last_name in it, presumably super_student and super_employee.

Use the table aliases that you nicely defined:

select ss.first_name as student_first_name, 
       ss.last_name as student_last_name
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top