Cannot figure out how to use multiple CTE
This fails
; with [cteOne] as (
select 1 as col
),
[cteTwo] as (
select 2 as col
)
select \'yesA\
The first one fails because a CTE or set of CTEs can only be followed by a single statement.
You could rewrite it as
; with [cteOne] as (
select 1 as col
)
select 'yesA' where exists (select * from [cteOne])
; with [cteTwo] as (
select 2 as col
)
select 'yexB' where exists (select * from [cteTwo])