Reputation: 1701
I try to join a standard table with a temporary one :
This is what i tried :
with temp1 as (
select * from table T )
select * from temp1, t2.field
left join temp1 t2 on temp1.id1 = t2.id2
It doesn't work properly. Any ideas ?
Thank you all.
Upvotes: 0
Views: 75
Reputation: 7180
Syntax for sql is select from where. What you've written here reads select from select from. Move the t2.field out of the from clause and into the select.
with temp1 as (
select * from table T )
select temp1.*, t2.field from temp1
left join temp1 t2 on temp1.id1 = t2.id2
Upvotes: 1
Reputation: 11365
Try this
WITH TEMP1 AS (SELECT * FROM TABLET)
SELECT
*
FROM
TEMP1 LEFT JOIN T2 ON ( TEMP1.ID1 = T2.ID2 )
Upvotes: 0