解决方案 »
- 我们单位服务器内存1G,执行sql查询(查询兄弟单位Oracle数据)时,出现。。。。。
- 简单的代码 却不是个简单的问题丹青 高手帮忙
- ORA-00936 我寫的SQL語句哪兒錯了?機器報的這個錯誤。ora-00936遺漏表達式。怎麼回事?
- oracle developer的连接问题
- oracle 锁表原因
- oracle8倍份的奇怪问题!
- 请大家给讲一下oracle9i中的tablespace和schema的概念和用法
- 看遍以前的帖子,我的问题依旧没有解决,求助!
- 怎样在Linux9上安装Oracle9i,我错误是什么原因造成的呢
- 一个MM的问题
- oracle同义词求助!谢谢
- 如何去除相同时间段
sw_04字段是拣配单号,是字母和数字的组合,不可能sum
count倒是可以,但是用count的话,就成了一个物料下所有c_sw04字段都为空才 sum(s.n_dryweight)
我想实现的是,如果同一个物料下的一个记录的c_sw04为空,就sum上,如果不为空,就不往上加
sw_04字段是拣配单号,是字母和数字的组合,不可能sum
count倒是可以,但是用count的话,就成了一个物料下所有c_sw04字段都为空才 sum(s.n_dryweight)
我想实现的是,如果同一个物料下的一个记录的c_sw04为空,就sum上,如果不为空,就不往上加
想到只能union
UNION的话,需要3分钟才能查出来,再和其他查询做连接
整改查询需要10分钟左右。。我想用户是受不了的
select s.c_materialid 物料编码,
sum (case
when s.n_dryweight> 0 and s.c_sw04 is null then s.n_dryweight
else
0 )
end 当日库存
from AG_TP_STOCK s
left join TB_MATERIELMAIN b
on b.c_materielid = s.c_materialid
where s.c_storageid = '20802079'
and b.c_factoryid = '2080'
group by s.c_materialid
sum (case
when s.n_dryweight> 0 and s.c_sw04 is null then s.n_dryweight
else 0 end ) 当日库存
from AG_TP_STOCK s
left join TB_MATERIELMAIN b
on b.c_materielid = s.c_materialid
where s.c_storageid = '20802079'
and b.c_factoryid = '2080'
group by s.c_materialid
select s.c_materialid 物料编码,
sum (case
when s.n_dryweight> 0 and s.c_sw04 is null then s.n_dryweight
else
0 )
end 当日库存
from AG_TP_STOCK s
where s.c_storageid = '20802079'
group by s.c_materialid请问不加外链接不行吗?