需求:找出代理商中没有挂商家的代理商
简单SQL如下:
select * from t_proxy tp where tp.id not in (SELECT tp.id as p_id FROM t_proxy tp start with tp.id in (select distinct tm.proxy_id from t_merchant tm where tm.proxy_id is not null) connect by prior tp.parent_id = tp.id)