I just want it to return
1
2
WITH
CTE1 AS
(
select value
UNION ALL
select value=value+1
FROM CTe1
WHERE value =2
)
select * from cte1
how come that doesnt work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following will print out
1, 2:The problem was that
valuewas not defined for your first CTE clause. I assume you wanted 1. Then the second CTE clause self-references the first one and adds1.