确定,给定以下数据集:
ID , name , lineManagerKey, lineManagerName
1 , Joe , null , null
2 , Herbert , 1 , Joe
3 , John , 1 , Joe
4 , George , null , null
5 , Paul , null , null
6 , Ringo , null , null
7 , Frank , null , null
8 , Jeff , 7 , Frank
我想返回以下内容:
Manager,Minion
Joe,Herbert
Joe,John
Frank,Jeff
我正以各种方式考虑可能要返回多行的查询?有什么想法吗?
答案 0 :(得分:1)
select lineManagerName as Manager,name as Minion from table where lineManagerName is not null;