mysql怎么通过查询直属上级,然后通过直属上级查询其上级一直查到最上级通过员工id查询
递归查询
with recursive temp as ( select * from table p union all select t.* from table t inner join temp t2 on t2.position_id = t.position_pid ) select * from temp
或者参考下这个 http://t.csdn.cn/HoDKk