Is this what you want?
with t1 as (
select a.col1 as c1, a.col2 as c2, b.col1 as c3, b.col2 as c4
from table1 a left join
table2 b
on a.col1 = b.col1
),
t2 as (
select c.c1, c.c2, c.c3, c.c4
from t1 c
)
select *
from t2;
You can define multiple CTEs with a with
statement. They are separated by commas.