;with cte as (select 1 as n union all select n+1 from cte where n+1 <= 31) select n from cte
This query uses a recursive Common Table Expression.
More information abount Recursive CTE's can be found here:
It might be a little bit confuse the first time you use it, but remember that a Recursion is a the result of stacked statements. In this particular case, we are stacking queries.
Any doubts and questions, fill in the comment section bellow.
No comments:
Post a Comment