更新时间:2023-11-30 20:01:40
select t.cust_ID,t.name, (CASE ISNULL(cte.lnode, 0) WHEN 1 THEN 'paid' ELSE 'not paid' END) lnode, (CASE ISNULL(cte.rnode, 0) WHEN 1 THEN 'paid' ELSE 'not paid' END)
rnode
from user_detail t
left join cte on cte.cust_ID = t.parentid
where user_detail.cust_ID = 'YOUR_ID'