Join a table to itself

后端 未结 7 1361
Happy的楠姐
Happy的楠姐 2021-01-26 00:15

this is one on my database tables template.

Id int PK
Title nvarchar(10) unique
ParentId int 

This is my question.Is there a problem if i creat

7条回答
  •  误落风尘
    2021-01-26 00:43

    Its called Self Join and it can be added to a table as in following example

    select e1.emp_name 'manager',e2.emp_name 'employee'
    from employees e1 join employees e2
    on e1.emp_id=e2.emp_manager_id 
    

提交回复
热议问题