I’m using DBeaver as a DBMS, and trying to update a table based on a join:
x
update cbn
set cbn.pathways = pc.pathways
from public.conformed_block_names cbn
left join pathwayslist_csv pc
on pc.block_code = cbn.block_code
where pc.block_code is not null
So what i’m trying to do is update the table conformed_block_names based on a join between this table and table pathwayslist_csv
However, I keep getting the error “ERROR: relation “cbn” does not exist”
I’ve tried restructuring the update in many different ways, but I’m not getting anywhere with it
Advertisement
Answer
This should work:
UPDATE conformed_block_names
SET pathways = pc.pathways
FROM pathwayslist_csv pc
WHERE pc.block_code = conformed_block_names.block_code
AND pc.block_code IS NOT null;