Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using DBeaver as a DBMS, and trying to update a table based on a join:

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

question from:https://stackoverflow.com/questions/65938720/update-join-on-postgresql-relation-does-not-exist

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
437 views
Welcome To Ask or Share your Answers For Others

1 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;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...