SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH CTE as (
  2.   SELECT child_id,parent_id
  3.   FROM Hierarchy
  4.   where parent_id ='Africa'
  5.  
  6.   UNION ALL
  7.  
  8.   SELECT Hierarchy.child_id,Hierarchy.parent_id
  9.   FROM Hierarchy
  10.     inner join CTE on Hierarchy.parent_id=cte.child_id
  11.   where Hierarchy.parent_id !='Africa'
  12. )
  13. SELECT *
  14. FROM CTE
  15. OPTION (MAXRECURSION 0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top