0

所以我有两个表需要汇总数据。

第一个看起来像这样:

zip code | key
x          1
x          2
x          3
y          4
y          5

第二个看起来像这样:

characteristics | key
a                 1
b                 1
c                 1
d                 2
e                 2
f                 3
g                 4

我需要加入他们才能看起来像这样......

zip code | key | characteristics

x          1     a
x          1     b
x          1     c
x          2     d
x          2     e
x          3     f
y          4     g
...        ...   ...

我想不出正确的子查询/连接是什么来实现这一点。非常感谢任何帮助。

4

1 回答 1

0

尝试这个

select table1.zipCode, table1.key, table2.characteristics from table1 inner join table2 on table1.key = table2.key

好的...然后试试这个。

select t1.zipcode, t1.keys, t2.character
from table_1 t1
full outer join Table_2 t2 on t1.keys = t2.keys
于 2013-07-19T15:40:10.770 回答