如何求雇员的直接上级和间接上级?
create table employee
(
eid int primary key,
ename varchar(10),
reportto int references employee(eid)
)
insert into employee select 1001,'rose',null
union select 1002,'will',1001
union select 1003,'yao',1002
union select 1004,'gigi',1002
union select 1005,'frank',1004
reportto记录职员的直接上级
求出该表任意职员的所有直接上级以及间接上级,包括自身
例如frank的上级包括frank,gigi,will,rose
老师们麻烦你们了....