add subquery to cte :     declare @nodeid int = '1';
    with cte as ( 
    select  cust_ID, name,null lnode, null rnode from  user_detail where 
    cust_ID = @nodeid 

    union all select t.cust_ID,t.name, ISNULL(cte.lnode, CASE WHEN t.joinside = 
    0 THEN 1 ELSE 0 END) 
    lnode, ISNULL(cte.rnode, CASE WHEN t.joinside = 1 THEN 1 ELSE 0 END) 
    rnode from  user_detail t inner join cte on cte.cust_ID = t.parentid )
    select cust_ID,name from cte where rnode='0' option (maxrecursion 0)

**Current Scenario:** [screenshot of above query results][1]



**What i want is:**
[screenshot of what i want][2]

***now i will explain what i want:***
the above query is getting results only from user_detail table. now i want to modify the query in such a way that it will also search in "installments" table for the "status" column of the respective cust_id (which the above query is returning).

The modified query will get the value of status from installments table based on cust_id.

And query will show the results in the third column as showing in 2nd screenshot.

i am not much familiar with cte and nested queries. I hope you guys will understand my problem.
  [1]: https://i.stack.imgur.com/RsPRj.png
  [2]: https://i.stack.imgur.com/e5OxK.png