Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to give join twice on same table in plsql

833676Mar 10 2011 — edited Mar 10 2011
i am writing a SQL Query in which i have to twice left outer join on the same table one on a primary key and
other on the foreign key i have written the query like this but giving me error


select * FROM OrderMst INNER JOIN
Employee_Mst ON Employee_Mst.EmpID = OrderMst.OrdByDocID INNER JOIN
Visit ON Visit.Visit_ID = OrderMst.OrdVisitID INNER JOIN
Patient ON Patient.PatientId = OrderMst.OrdPatientID LEFT OUTER JOIN

Institute_Master ON OrderMst.RefInstitute = Institute_Master.Institute_Id LEFT OUTER JOIN ---1 join here

Institute_Master ON OrderMst.ReferToInstitute = Institute_Master.Institute_Id-- 2 join here


note : Institute_Id is primary key of table Institute_Master
: ReferToInstitute foreign key OrderMst


this is giving me error
Error report:
SQL Error: ORA-00918: column ambiguously defined
00918. 00000 - "column ambiguously defined"
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2011
Added on Mar 10 2011
4 comments
4,393 views