Anjali Khan

Anjali Khan

  • NA
  • 867
  • 224.5k

my selfjoin query getting error

Mar 25 2018 11:34 PM
Hi frnds
 
Below my table  
-----------------------------------------------------------
EmpId             EmpName             ManagerId
______________________________________
 
   1                           A                              1
   2                           B                               1
   3                           C                              2   
   4                           D                              3
   5                           E                              4
and my self join query is
 
select e1.EmpName as ManagerName, e2.EmpName as EmpName
from EmpTest
selfjoin EmpTest
On e1.EmpId = e.ManagerId
 
when i execute the query it is showing error like 
 
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'EmpTest'.
 
please provide the write ans 

Answers (6)