New method added to get the correlated sub query for the paret id of the nodes