统计sql

select device.USEUNIT, sum(
(select sum(czsp_table.quantity) CZSP from HG_DEVICEMANAGE czsp_table
where czsp_table.DEVICETYPE=24 and czsp_table.fd_objectid=device.fd_objectid)) czsp,
sum(
(select sum(tsdn_table.quantity) TSDN from HG_DEVICEMANAGE tsdn_table
where tsdn_table.DEVICETYPE=5 and tsdn_table.fd_objectid=device.fd_objectid)) tsdn,
sum(
(select sum(bjbdn_table.quantity)  BJBDN from HG_DEVICEMANAGE bjbdn_table
where bjbdn_table.DEVICETYPE=6 and bjbdn_table.fd_objectid=device.fd_objectid)) bjbdn,
sum(
(select sum(sxj_table.quantity)  SXJ from HG_DEVICEMANAGE sxj_table
where sxj_table.DEVICETYPE=1 and sxj_table.fd_objectid=device.fd_objectid)) sxj,
sum(
(select sum(zxj_table.quantity)  ZXJ from HG_DEVICEMANAGE zxj_table
where (zxj_table.DEVICETYPE=3 or zxj_table.DEVICETYPE=2) and zxj_table.fd_objectid=device.fd_objectid)) zxj,
sum(
(select sum(jcsb_table.quantity)  JCSB from HG_DEVICEMANAGE jcsb_table
where jcsb_table.DEVICETYPE=25 and jcsb_table.fd_objectid=device.fd_objectid)) jcsb,
sum(
(select sum(qtsb_table.quantity)  QTSB from HG_DEVICEMANAGE qtsb_table
where qtsb_table.DEVICETYPE=23 and qtsb_table.fd_objectid=device.fd_objectid)) qtsb
from HG_DEVICEMANAGE device where device.IS_DEL='0' group by device.USEUNIT
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值