我有2个版本的oracle, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 和 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
我有这个sql:
select an.idai, t1.fecha, 53, t1.val_d60, 0
from
( select ides, cana, ctec, trunc(fecha_d60, 'MM') as fecha, val_d60,
row_number() over (partition by ides,cana,ctec, trunc(fecha_d60, 'MM')
order by val_d60 asc) as orden
from azul_estdata60
where idflagv = 11
and ides < 25
and fecha_d60 >= '01/01/2016' and fecha_d60 <= '31/12/2016'
and cana = 8
order by ides, cana, ctec, val_d60 desc
) t1,
( select ides, cana, ctec, trunc(fecha_d60, 'MM') as fecha,
round(count(*)*.5,0) as percentil
from azul_estdata60
where idflagv in (11,12,13)
and ides < 25
and fecha_d60 >= '01/01/2016' and fecha_d60 <= '31/12/2016'
and cana = 8
group by ides, cana, ctec, trunc(fecha_d60, 'MM')
) t2
inner join azul_analogin an
on an.cana = t2.cana
and an.ctec = t2.ctec and an.ides = t2.ides
where t1.ides = t2.ides
and t1.cana = t2.cana
and t1.ctec = t2.ctec
and t1.fecha = t2.fecha
and orden = percentil;
它适用于11.2.0.1.0但是,在11.2.0.3.0上,我收到此错误:
ORA-00979: no es una expresión GROUP BY
00979. 00000 - "not a GROUP BY expression"
*Cause:
*Action:
我该怎么做才能解决这个问题?
谢谢 .
1 回答
我不确定你为什么会得到这个错误 . 您的查询看起来像语法上的好 . 但更复杂 . 我尝试重写一下 . 首先,我将日期指定为日期 . 然后我排除第二个子查询并用第一个子查询编译它 . 结果我接下来: