递归查询

with T as
(
select id,nick_name,p_uid from dt_users where p_uid=96
union all
select h.id,h.nick_name,h.p_uid from dt_users h join T h1 on h.p_uid=h1.id
)

select * from dt_orders
where user_id in(select id from T)

posted @ 2018-09-28 17:14  你的斗志并没有失去  阅读(114)  评论(0编辑  收藏  举报