I am looking at different CTE examples online since I am trying to learn CTE but I a came across two primary ways to write CTEs
- Recursive CTE which has an anchor and then UNIONs with the child query which uses the results from anchor and previous calls
- Multiple CTE where there are two distinct CTEs defined comma saperated however, the second one ends up referring to the first one which is kind of like the Recursive CTE.
I am referring to an example below:
http://blog.sqlauthority.com/2009/08/08/sql-server-multiple-cte-in-one-select-statement-query/
and wondering how is it different than a Recursive with UNION and a single CTE name?