Subject Select query from IB6.0 to FB 1.5 RC4
Author Luiz

I am migrating an app from IB 6.01 to FB1.5 RC4 and I am getting the next

"ISC ERROR CODE:335544569

Dynamic SQL Error
SQL error code = -104
Invalid expression in the select list (not contained in either an aggregate
function or the GROUP BY clause)"

My Select Query is the next. It was working in IB 6.01.

What am I doing wrong?

"select B.isdiu,C.Nome as Medico,F.Nome as Servico,
sum(A.Stotal) as Tot_clin,
(Select count(S1.Nr) from Porc_med S1 where
S1.Nr=C.Nr and S1.porcD>0) as Fator_div,
D.porcD as PorcMedico,
C1.TOT_DESP as Despesa,
sum(A.stotal*D.porcd/100) as Part_MED,
sum(A.stotal*(D.porcd/100)*E.IR/100) as IR,
sum(A.stotal*(D.porcd/100)*E.ISS/100) as ISS,
sum(A.stotal*(D.porcd/100)*(100-E.IR-E.ISS)/100) as LIQ,
C1.TOT_DESP*D.porcd/100.0/(Select count(S1.Nr) from Porc_med S1 where
S1.Nr=C.Nr and S1.porcD>0) as Desp_med,
sum(A.stotal*(D.porcd/100)*(100-E.IR-E.ISS)/100*C1.GLOSA/100) as GLOSA
from Medint C
left join GRUPO_MED C1 on C1.Nr=C.Nr and C1.Diurno='T'
join relfat B on C.Nr=B.medint
join fatura A on A.nrf=B.nrf and A.stipo<>4
join porc_med D on D.Nr=C.Nr and D.nserv=A.stipo
join servbase F on A.stipo=F.nserv
join Planos E on E.ident_cp=B.ident_cp
where B.Data>=:di and B.Data<:df and C.Nr=:v_med
group by C.Nome,B.isdiu,F.Nome, C1.TOT_DESP, D.porcd
ORDER BY 2,1 desc,3"