【发布时间】:2014-11-11 12:24:46
【问题描述】:
我正在创建 sql 查询以从表中返回信息,但我遇到了一个特别的问题。我想返回科罗拉多州的所有城市地区。 查询的实际定义是
Return the names (name10) of all urban areas (in alphabetical order) that are entirely contained
within Colorado. Return the results in alphabetical order. (64 records)
我使用的表是 tl_2010_us_state10(它存储状态信息)。我想我将在此表中使用 name10 变量,因为它包含所有州的名称。
Table "public.tl_2010_us_state10"
Column | Type | Modifiers
------------+-----------------------------+-------------------------------------
gid | integer | not null default
region10 | character varying(2) |
division10 | character varying(2) |
statefp10 | character varying(2) |
statens10 | character varying(8) |
geoid10 | character varying(2) |
stusps10 | character varying(2) |
name10 | character varying(100) |
然后我有一个显示所有城市信息的表格。再一次,我想我将使用 name10 变量,因为它存储了所有城市区域的名称。
Table "public.tl_2010_us_uac10"
Column | Type | Modifiers
------------+-----------------------------+-------------------------------------
gid | integer | not null default
uace10 | character varying(5) |
geoid10 | character varying(5) |
name10 | character varying(100) |
我在 sql 中写的代码是
select a.name10 from tl_2010_us_uac10 as a join tl_2010_us_state10 as b where (b.name10 = 'colorado');
但我收到此错误
LINE 1: ...l_2010_us_uac10 as a join tl_2010_us_state10 as b where (b.n...
gid 是主键
【问题讨论】:
标签: datatable subquery postgis psql