Thank you both for pointing me in the right direction. I've updated my question a little bit. Now i understand how to write the CTE query, but i'm running into issues with maxrecursion of 32767. Does any of you have an idea how to bypass that?
Cheers,
John
Cheers,
John