Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...