Hi all - i have this code to get all the children under a particular parent and it is working but it only works with one parent at a time. how can i modify this so that I can pass multiple parents and get their children as well those parents? Thanks for helping out.
with [CTE] as ( select * from [TheTable] c where c.[ParentId] = 1 union all select * from [CTE] p, [TheTable] c where c.[ParentId] = p.[NodeId] ) select * from [CTE]