从 PostgreSQL 的内部连接中排除列

Excluding a column from an inner join in PostgreSQL

我正在尝试排除由两个 table 共享的列 (county),以便我可以在查询中执行 LEFT JOIN。这是我认为可行的方法,但似乎存在一些问题(下面产生 ERROR: syntax error at or near "LEFT")。我该怎么做才能完成这项工作?

CREATE TABLE levee_prioritization.svi_justice_communities_joined AS
SELECT * FROM ((SELECT COLUMN_NAME FROM information_schema.columns
 WHERE table_schema = 'levee_prioritization'
   AND table_name = 'svi2018_us_tract') AS allColumns 
   WHERE allColumns.COLUMN_NAME NOT IN ('county'))
LEFT JOIN levee_prioritization.justice40_communities b ON (a.fips = 
LPAD(round(b.geoid_tract)::text, 11));

您没有为内部指定视图名称 select:

CREATE TABLE levee_prioritization.svi_justice_communities_joined AS
SELECT * FROM (SELECT * FROM (SELECT COLUMN_NAME FROM information_schema.columns
 WHERE table_schema = 'levee_prioritization'
   AND table_name = 'svi2018_us_tract') AS allColumns 
   WHERE allColumns.COLUMN_NAME NOT IN ('county')) a
LEFT JOIN levee_prioritization.justice40_communities b 
ON (a.fips = LPAD(round(b.geoid_tract)::text, 11));