Thursday, September 15, 2016

SQL Self join

Self join is called  nothing but a table join itself .Self join is bad thing but some times bad structure table have to do this join.Table name Employee info.

sql table for self join














Query: 
               
SELECT E.ManagerID ,E.Address, M.EmployeeId
From EmployeeInfo E
inner join EmployeeInfo  M
ON  E.ManagerID =  M.EmployeeId


Result:

sql self join result

No comments:

Post a Comment