I am trying to join a common table expression to an existing table (table1) as follows.
select column1, column2 from table1
left outer join
;with cte as (
select column1, column2 from table2)
select column1, column2 from cte
on table1.column1 = cte.column1
The errors are:
What am I doing wrong? Should I be using a CTE for this task?
The CTE must come at the beginning of the query.
with cte as (
select column1, column2 from table2
)
select column1, column2 from table1
LEFT JOIN cte
on table1.column1 = cte.column1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.