SELF JOIN is used to compare the table itself.
There is no any keyword “SELF” exists in SQL server.
LEFT/RIGHT/FULL keywords we can use for the self-join query. Here the LEFT and RIGHT tables both are same.
Syntax:
SELECT column_name(s)
FROM table1 t1
JOIN table1 t2
ON t1.column_name=t2.column_name;
FROM table1 t1
JOIN table1 t2
ON t1.column_name=t2.column_name;
Example:
SELECT E.EmpID, E.EmpName, E.DeptID, E1.EmpName FROM tbl_Employees E
[LEFT/RIGHT/INNER]JOIN tbl_Employees E1




SQL Server
C#.Net
ASP.Net
ADO.Net
jQuery

No comments:
Post a Comment