我有一张名为Sound的表
和其他表格像这样抨击SoundK
和其他表格像这样的SoundD
所以如何计算所有三个表Sound + SoundK + SoundD
的字段(命中)为总数提前致谢
RGDS for All
答案 0 :(得分:0)
以通用方式,您可以将三个表合并在一起,因为它们共享相同的数据,然后进行求和。
select sum(hit)
from (
select hit
from Sound
union
select hit
from SoundK
union
select hit
from SoundD
)
答案 1 :(得分:0)
SELECT SUM (soundsum) FROM (
SELECT SUM(hit) AS SoundSum FROM Sound AS s
UNION ALL
SELECT SUM(hit) AS SoundSum FROM SoundK AS s
UNION ALL
SELECT SUM(hit) AS SoundSum FROM SoundD AS s
) X