PostgreSQL:错误:关系列不存在 [英] PostgreSQL: Error: column of relation does not exist
本文介绍了PostgreSQL:错误:关系列不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UPDATE master as m
SET m.husband = p.id
From per as p
where m.drid = p.drid AND p.address > 80000 AND p.address <= 154969
我有一个名为
其中有一个名为 id
的列。基本上,我想在我的另一个表中 master
复制这些ID在其中
子句。
I have a table called per
which has column called id
. Basically, I want to copy these ids in my another table called master
on the where
clause.
但我收到一个错误,关联主的列m不存在。
m不是列。我不知道我在哪里错了?
But I am getting an error saying, column "m" of relation "master" does not exist. m is not a column. I am not sure where I went wrong?
推荐答案
从 SET
操作删除表别名 m
,并使其 SET husband = p.id
Try it like below rather; remove table alias m
from SET
operation and make it SET husband = p.id
UPDATE master m
SET husband = p.id
From per p
where m.drid = p.drid
AND p.address > 80000
AND p.address <= 154969
<所有像
(OR) without using table alias at all like
UPDATE master
SET husband = per.id
From per
where master.drid = per.drid
AND per.address > 80000
AND per.address <= 154969
请参阅 Postgres Documentation For More
这篇关于PostgreSQL:错误:关系列不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文