请问各位大神以下oracle plsql语句怎么写
请问各位大神,如何将上图中原始数据区关联到代码区,然后显示具体的名称并汇总统计为汇总展示区的效果,希望各位大神赐教...
请问各位大神,如何将上图中原始数据区关联到代码区,然后显示具体的名称并汇总统计为汇总展示区的效果,希望各位大神赐教
展开
展开全部
select c.ckmc 仓库名称, t.合计, t.物品A, t.物品B, t.物品C, t.物品D, t.物品E
from ckdm c,
(select a.ckdm,
sum(decode(a.hpdm, 301, a.je)) +
sum(decode(a.hpdm, 302, a.je)) +
sum(decode(a.hpdm, 303, a.je)) +
sum(decode(a.hpdm, 304, a.je)) +
sum(decode(a.hpdm, 305, a.je)) 合计,
sum(decode(a.hpdm, 301, a.je)) 物品A,
sum(decode(a.hpdm, 302, a.je)) 物品B,
sum(decode(a.hpdm, 303, a.je)) 物品C,
sum(decode(a.hpdm, 304, a.je)) 物品D,
sum(decode(a.hpdm, 305, a.je)) 物品E,
from ckhp a
group by a.ckdm) t
where t.ckdm = c.ckdm
group by ckmc
order by c.ckdm;
没有实际建表,你试下是否可行。
from ckdm c,
(select a.ckdm,
sum(decode(a.hpdm, 301, a.je)) +
sum(decode(a.hpdm, 302, a.je)) +
sum(decode(a.hpdm, 303, a.je)) +
sum(decode(a.hpdm, 304, a.je)) +
sum(decode(a.hpdm, 305, a.je)) 合计,
sum(decode(a.hpdm, 301, a.je)) 物品A,
sum(decode(a.hpdm, 302, a.je)) 物品B,
sum(decode(a.hpdm, 303, a.je)) 物品C,
sum(decode(a.hpdm, 304, a.je)) 物品D,
sum(decode(a.hpdm, 305, a.je)) 物品E,
from ckhp a
group by a.ckdm) t
where t.ckdm = c.ckdm
group by ckmc
order by c.ckdm;
没有实际建表,你试下是否可行。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询