Boa noite
Estou fazendo um relatório e puxei todos os dados pelo PL/SQL Developer.
Lá a consulta roda normalmente. Porém quando rodo dentro da Consulta SQL do RM Nucleus
Retorna um erro:
Erro de sintaxe: era esperado ',' ou 'WHERE' (etc.) após alias da tabela.
Alguém poderia me ajudar?
Select distinct
t.idmov, t.codtmv, t.campoLivre1, t.numeroMov,
t.dataEmissao, f.nome,
(sum(tt.valorTotalItem) + B.ipi + C.ST) ValorBruto,
B.ipi, C.ST, sum(tt.valorTotalItem) as valorTotalItem,
D.Comissao, ((D.comissao / sum(tt.valorTotalItem)) * 100) Percentual
from tmov t
inner join fcfo f on t.codCfo = f.codcfo
inner join titmmov tt on tt.idMov = t.idmov and t.codColigada = tt.codColigada
left join
(
Select idMov, sum(nvl(valor, 0)) as IPI
From ttrbMov
where codtrb = 'IPI'
Group By idMov
) B On B.idMov = t.idMov
inner join
(
Select idMov, sum(nvl(valor, 0)) as ST
From ttrbMov
where codtrb = 'ICMSST'
Group By idMov
) C On C.idMov = t.idMov
inner join
(
Select idMov, sum(((tt.valorTotalItem * tt.comissaoRepres)) / 100) Comissao
from titmmov tt
Group by idMov
) D On D.idMov = t.idMov
where
dataEmissao >= :dtIni and
dataEmissao <= :dtFim and
codtmv in ('2.2.02', '2.2.01', '1.3.02') and
t.idmov = '70736'
Group By t.idmov, t.codtmv, t.campoLivre1, t.numeroMov,
t.dataEmissao, f.nome, valorBruto,
B.ipi, C.ST, D.comissao