> 其他 >
有两个表,A(NAME,NUM1),B(NAME,NUM2),我要输出(NAME,NUM1,NUM2)用SQL语言应该怎么写?
人气:215 ℃ 时间:2020-03-26 04:39:44
解答
select Name,Sum(Num1) Num1,Sum(Num2) Num2 From
(
select Name,Num1,0 as Num2
from A
Union All
select Name,0 as Num1,Num2
from B
) C
group by C.Name
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版