Hi All! How to use self join in sql server and what's it's important. Please give any example. Thanks in advance!
Self Join
Self join correlates rows of a table with the other rows of the same table. It is used when a table has to be joined to itself to produce results.
Example
First you have to create a table EmpTable and enter the details like this:
EmpID EmpName EmpMgrID
1 Smith 2
2 Sai 3
3 Suresh 1
4 Bill 2
5 Steve 4
Output