I get this error when I try to update a column of Table 1 that is like a column of Table 2.
Target table must be part of an equijoin predicate.
update test
set category = t1.category
from category_type t1, test t2
where t2.link ilike '%' || t1.type || '%'
and t2.link ilike '%.nike.com/%';
Category_Type Table shown below:
type category
sandals shoes
boots shoes
t-shirts apparel
-pants apparel
I don't know Redshift, but in Postgres you must not repeat the target table in the
FROM
clause of anUPDATE
statement:You should be able to join with a subquery like this:
The AWS docs have join examples further down the page. The last example shows the benefit of the subquery.
The basic form of this query is: