Recursive cte sql. I was just reading an article on it.