【发布时间】:2015-08-19 12:35:46
【问题描述】:
这是table_1
d1
--------
a
b
c
d
e
table_2
d2
--------
a
b
d
table_3
d3
--------
b
c
预期的新表是上述所有表中 a、b、c、d、e 的计数之和
final_table
a 2
b 3
c 2
d 2
e 1
【问题讨论】:
这是table_1
d1
--------
a
b
c
d
e
table_2
d2
--------
a
b
d
table_3
d3
--------
b
c
预期的新表是上述所有表中 a、b、c、d、e 的计数之和
final_table
a 2
b 3
c 2
d 2
e 1
【问题讨论】:
你可以做一个简单的表联合和这样的计数
select id, count(id)
from(
select id from d1
union all
select id from d2
union all
select id from d3
) t
group by id
【讨论】: