---
title: "How to use self join in sql server and what's it's important."  
description: "How to use self join in sql server and what's it's important."  
author: "Anonymous User"  
published: 2013-05-16  
updated: 2013-05-16  
canonical: https://www.mindstick.com/forum/901/how-to-use-self-join-in-sql-server-and-what-s-it-s-important  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# How to use self join in sql server and what's it's important.

Hi All!\
How to use [self](https://www.mindstick.com/articles/44535/smart-ways-to-secure-self-storage-facilities) [join in sql](https://www.mindstick.com/forum/33686/what-is-a-self-join-in-sql-server) [server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) and what's it's important.Please give any example.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

**Self [Join](https://www.mindstick.com/articles/1487/join-sleep-and-interrupt-methods-in-c-sharp-threading)**

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

```
SELECT E2.EMPNAME,E1.EMPNAME as 'MANAGER'FROM EmpTable E1INNER JOIN EmpTable E2ON E1.EMPID=E2.EMPMGRID
```

## Output

EmpName Manager\
Suresh SmithSmith SaiBill SaiSai SureshSteve Bill

\

\

\

\


---

Original Source: https://www.mindstick.com/forum/901/how-to-use-self-join-in-sql-server-and-what-s-it-s-important

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
