我想写一份工作来加入和汇总来自两个不同服务的数据。问题是其中一个来源只能提供汇总数据。
所以,如果我想计算这个 -
#submenu_Container:nth-child(2)
我做 -
SELECT SUM(a.a), SUM(x.x)
FROM a INNER JOIN
x
ON a.k=x.k
group by a.b, a.k, x.y;
最后,
Table a' = SELECT SUM(a.a) as a1, a.k as k1 FROM a GROUP BY a.k,a.b;
Table x' = SELECT SUM(x.x) as x1, x.k as k1 FROM x GROUP BY x.y, x.k;
我知道这会产生不准确的结果。但看起来它在某些情况下确实有效,例如,当两个数据源仅按连接键分组时。
我想知道在所有情况下这会产生准确的结果吗?