WHAT IS A SELF JOIN IN SQL SERVER

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 584  View(s)
Ratings:
Rate this:
I want to know Self join in sqlserver How to use It.please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: What is a self join in sql server

    A self join is basically when a table is joined to itself. The way you should visualize a self join for a given table is by imagining that a join is performed between two identical copies of that table. And that is exactly why it is called a self join – because of the fact that it’s just the same table being joined to anothercopy of itself rather than being joined with a different table.

    SELECT e1.Emp_ID,e1.Emp_Name,e1.Emp_Sal

    FROM employee e1, employee e2

    WHERE e1.Location = e2.Location

    AND e2.Location='allahabad'

  1. Ankit Singh

    Post:341

    Points:2389
    Re: What is a self join in sql server

    self join is a join in which a table is joined with itself. For example, when you require details about an employee and his manager (also an employee)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!