Gnudiff
Gnudiff

Reputation: 4305

Postgres referencing column in an INSERT / select join?

I have a somewhat complex set of queries, the relevant part is this:

INSERT INTO my_table (product_id, ... ) 
(SELECT replace(stuff...) as "product_id", ...
FROM sku_table SKU 
/* multiple joins */
LEFT JOIN table2 T2 ON SKU."product_id"=T2."product_id" 
...

On addition of the LEFT JOIN PG complains it can't find column product_id (regardless of quotes/no quotes) in the left table.

How can I refer in the join to the column selected from SKU table here?

Upvotes: 0

Views: 8

Answers (0)

Related Questions