用于多级别查询
递归子查询因子化 (Recursive Subquery Factoring, RSF)
with son(lvl,user_name,user_id,parent_id) as
(select 4,user_name,user_id,parent_id from user_profiles where user_id = 5
union all
select son.lvl-1, parent.user_name,parent.user_id,parent.parent_id
from son, user_profiles parent
where son.parent_id = parent.user_id)
select lvl,user_name,user_id,parent_id from son;