WHAT IS A SELF JOIN IN SQL SERVER

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 750  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:258

    Points:1840
    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'

      Modified On Apr-10-2018 06:27:02 AM
  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)

      Modified On Apr-10-2018 06:27:12 AM

Answer

NEWSLETTER

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