我正在努力获得正确的结果,但我找不到正确的方法。
我有这张桌子:
我想得到像这样的结果
这是我的代码:
SELECT employee_ID, first_name, manager_id ,
(SELECT first_name from employees where MANAGER_ID= employee_id)
from employees
我只有前3列,第4列是空的,因为错误的选择
答案 0 :(得分:1)
自我加入同一张桌子
<div class="history">
<div class="box1">
<p>
The story starts in 2010 with Hartstown
</p>
</div>
<div class="box2">
<img src="images/clubs.jpg" alt="Clubs">
</div>
<div class="box3">
<img src="images/clubs1.jpg" alt="Clubs">
</div>
<div class="box4">
<h3>Clubs Officialy Merge... </h3>
<p>May 2011 saw the Official launch of Hartstown Aldridge Legends X1 in Dalymount Park...
</p>
</div>
<div class="box5">
<h3>Our First Full Season... </h3>
<p>We started the 2011 / 2012 Season with Approx 280 registered club altogether we had 18 Teams…..
</p>
</div>
<div class="box6">
<img src="images/logo.jpg" alt="Logo">
</div>
<div class="box7">
<h3>Forging Ahead... </h3>
<p>We presently have approx 400 Registered Club Players and approx 60 nd 2 Over 35'5 Teams and we are still growing...
</p>
</div>
</div>
答案 1 :(得分:0)
对不起我的错误解释,我有5列,第一个不在图片中,因为它唯一的行ID,我的第一行是员工ID,第二行是first_name,第三行是经理ID,第四行应该是第一行经理的名字。经理名称是当经理ID等于员工ID时,例如员工ID = 206,名字是William,经理ID是205.名字应该是Shelley,因为Shelley的员工ID是205