[英]ERROR: column “owner_name” specified more than once
I'm trying to create a new table, using A table that doesn't contain account_id in B table. 我正在尝试使用不包含B表中的account_id的A表创建一个新表。 However, I encountered an error:
但是,我遇到了一个错误:
ERROR: column "owner_name" specified more than once
错误:列“ owner_name”指定了多次
Create table dallas_50000_2
AS SELECT * from "2018_texas_county_dallas_individuals_person" A
LEFT JOIN dallas_50000_copy B
ON A.account_id = B.account_id
WHERE B.account_id IS NULL;
You should either explicitly quote all the column names of at least one table that has the common columns (eg:- owner_name and account_id ) and specify them only once or give a separate alias for the common column names. 您应该显式引用至少一个具有公共列的表的所有列名(例如:-owner_name和account_id),并仅指定一次,或者为公共列名提供单独的别名。 Otherwise it becomes ambiguous whose column to be used for the target table's columns.
否则,它的模棱两可将其列用作目标表的列。
Create table dallas_50000_2
AS SELECT A.* , B.col1 , B.col2 --other columns that are not common to A
from "2018_texas_county_dallas_individuals_person" A
LEFT JOIN dallas_50000_copy B
ON A.account_id = B.account_id
WHERE B.account_id IS NULL;
OR 要么
Create table dallas_50000_2
AS SELECT A.account_id as a_account_id, A.owner_name as A_owner_name,
B.col1 , B.col2,B.owner_name as B_owner_name
from "2018_texas_county_dallas_individuals_person" A
LEFT JOIN dallas_50000_copy B
ON A.account_id = B.account_id
WHERE B.account_id IS NULL;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.