如何避免SQL查询出的重名字段被覆盖
发布网友
发布时间:2022-04-20 14:27
我来回答
共1个回答
热心网友
时间:2023-09-09 06:45
select a.no
,sum(case when a.index = 1 then a.value else 0 end)/count(distinct a.calcdate) as aa
from A
group by a.no
union all
select c.no
,sum(case when c.index = 5 then c.value else 0 end)/count(distinct c.calcdate) as cc
from C
group by C.no