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)
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)