SQL合并
时间:2021-07-01 10:21:17
帮助过:26人阅读
SELECT
idName,SUM(Money),SUM(Revenue)
FROM
(
SELECT agentID AS idName,SUM(totalMoney) AS Money,0 AS Revenue FROM lm_agent_finance_webstat GROUP BY agentID
UNION ALL
SELECT agentID AS idName,0 AS Money,SUM(totalRevenue) AS Revenue FROM lm_agent_financestat GROUP BY agentID
) a
GROUP BY
idName
SQL合并
标签:bsp dna revenue div one group eve sel nio