sql语句优化
select dn,
node,
(select sum(a.clear_during)
from al_history a
where a.org_no = 65396
and a.dn = t.dn
and a.node = t.node) as Mains,
(select sum(b.clear_during)
from al_history b
where b.org_no = 65397
and b.dn = t.dn
and b.node = t.node) as DG,
(select sum(c.clear_during)
from al_history c
where c.org_no = 65398
and c.dn = t.dn
and c.node = t.node) as Battery
from al_history t
where (org_no = 65396)
or (org_no = 65397)
or (org_no = 65398)
group by t.dn, t.node
[解决办法]
同一张表啊
不用这么复杂
用decode+sum就可以实现
[解决办法]
sql语句优化,该怎么处理
sql语句优化select dn,node,(select sum(a.clear_during)from al_history awhere a.org_no 65396and a.d
