MySQL Forums
Forum List  »  Newbie

Is this possible: left join on table aliases?
Posted by: David Gibb
Date: June 16, 2005 02:27PM

mysql>select emp.*, sup.fname as supF, sup.lname as supL
from employee as emp, employee as sup, emp left join sup on emp.supid=sup.empid
where emp.username="dgibb";

Error 1066: Not unique table/alias: 'emp'


The table structure is pretty easy, the employee table has a primary key on empid, and a foreign key on supid(the empid of this employee's supervisor).

The result should give all employee fields, and if there is a supervisor attached to this employee record, give the first and last name.

My question is:
Is it even possible to a left join on the same table using aliases?, and if so, how?

Options: ReplyQuote


Subject
Written By
Posted
Is this possible: left join on table aliases?
June 16, 2005 02:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.