有人知道为什么这个查询不起作用?

时间:2017-11-16 10:58:47

标签: oracle

当我这样做时:

select distinct
       a.ano ano,
       a.mes as mes,
       count(*) as percentagem
from   (
  select substr(intfaims.f_aims_to_fecha@intfaims(nt.roster.dutyday@intfaims,0,2),5,2) as mes,
         substr(intfaims.f_aims_to_fecha@intfaims(nt.roster.dutyday@intfaims,0,2),1,4) as ano
  from   nt.roster@intfaims
  where  nt.roster.LEG_FLT@intfaims > 0
) a 
group by a.ano, a.mes

一切正常

但是当我应用选择时他们没有:

select *
from   (
  select distinct
         a.ano ano,
         a.mes as mes,
         count(*) as percentagem
  from   (
    select substr(intfaims.f_aims_to_fecha@intfaims(nt.roster.dutyday@intfaims,0,2),5,2) as mes,
           substr(intfaims.f_aims_to_fecha@intfaims(nt.roster.dutyday@intfaims,0,2),1,4) as ano
    from   nt.roster@intfaims
    where  nt.roster.LEG_FLT@intfaims > 0
  ) a 
  group by a.ano, a.mes
) b

我明白了:

Error: no es una expression group by

0 个答案:

没有答案