With Within With


With Within With


Just wanted to know that ' is it possible to use CTE(Common table expression) within  another CTE?


With CTE1 (c1,c2) as (select c1,c2 from table1),

CTE2 (c1,c2,c3) as (select CTE1.c1, CTE1.c2, Table2.c3 from CTE1 left join TABLE2 on Table2.c1=CTE1.C1)

Select * from CTE2;

I know we can do the same using Volatile Table. But just wanted to know if upper code works?

Tags (1)