【发布时间】:2017-08-24 02:44:16
【问题描述】:
执行 SQL 时出现此错误,状态:不是单组组函数:
[SQL]select distinct bd.name aaa,
substr(m.code,0,4) as mcode,
sum(p.nassistnum) BB,
sum(case when p.vbdef4='~' then '0' else p.vbdef4 end) CC
from bd_material_v m
inner join ic_purchasein_b p
on m.pk_source=p.cmaterialvid
inner join ic_purchasein_h h
on h.cgeneralhid = p.cgeneralhid and h.ctrantypeid='1001A210000000002UW7' and h.vdef8='~'
inner join bd_marbasclass bd
on bd.code=substr(m.code,0,4)
where m.creator='1001A210000000000IIQ'
order by substr(m.code,0,4)
-- and h.pk_org in (parameter('param3'))
-- and substr(h.dbilldate,1,10) >= parameter('param1')
-- and substr(h.dbilldate,1,10) <= parameter('param2')
[Err] ORA-00937: not a single-group group function
SQL 如下:
select distinct bd.name aaa,
substr(m.code,0,4) as mcode,
sum(p.nassistnum) BB,
sum(case when p.vbdef4='~' then '0' else p.vbdef4 end) CC
from bd_material_v m
inner join ic_purchasein_b p
on m.pk_source=p.cmaterialvid
inner join ic_purchasein_h h
on h.cgeneralhid = p.cgeneralhid and h.ctrantypeid='1001A210000000002UW7' and h.vdef8='~'
inner join bd_marbasclass bd
on bd.code=substr(m.code,0,4)
where m.creator='1001A210000000000IIQ'
order by substr(m.code,0,4)
我搜索了 Stackoverflow,但找不到我的原因:
【问题讨论】: