Oracle Query Error

0

When executing the query below, the following error is occurring. By analysis, the error occurs when I place the sum. For what reason?

  

"ORA-00918: column defined ambiguously   00918. 00000 - "column ambiguously defined"   * Cause:
  * Action: Error on line: 4 Column: 35 "

Following query.

select
  e.nm_fantasia_estab ESTABELECIMENTO,
  t.ds_caixa CAIXA,
  sum(tasy.obter_valor_trans_financ(nr_sequencia, 'E')) VL_ENTRADA, -- Esse 
  tasy.obter_valor_trans_financ é uma função
  nvl(d.vl_saldo_inicial,'0') SALDO_INICIAL,
  nvl(d.vl_saldo,'0')SALDO_FINAL
from tasy.caixa t
  left join tasy.estabelecimento e on e.cd_estabelecimento = t.cd_estabelecimento
  left join tasy.caixa_saldo_diario d on d.nr_seq_caixa = t.nr_sequencia
  left join tasy.transacao_financeira f on f.NR_SEQUENCIA = t.NR_SEQUENCIA
where t.cd_estabelecimento = 241 
group by e.nm_fantasia_estab, t.ds_caixa, nvl(d.vl_saldo_inicial,'0'), nvl(d.vl_saldo,'0');
    
asked by anonymous 14.12.2018 / 20:13

0 answers