3
I have the following query:
SELECT rp.colaborador as codigo_, t.nome, count(rp.*) as presencas,
((100 * (select count(rp.*) from empresa.cad_reuniao_presencas rp
join empresa.cad_terceiros t on t.codigo = rp.colaborador
join empresa.cad_reunioes r on r.codigo = rp.reuniao
where r.data_reuniao > t.data_cadastro and t.codigo = ?
group by rp.colaborador, t.codigo )) / (select max(codigo) from empresa.cad_reunioes rp) || '%') as porcentagem
FROM empresa.cad_reuniao_presencas rp
join empresa.cad_terceiros t on t.codigo = rp.colaborador
join empresa.cad_reunioes r on r.codigo = rp.reuniao
where r.data_reuniao > t.data_cadastro
group by t.nome, rp.colaborador order by presencas desc;
Where has the ?
(question mark) would you like to pass Third Party code to correctly pick up the percentage attendance at meetings, how could you do that? If I put a fixed value works, but ai on all lines appears only from a Third.
Thank you very much, I solved with a Function, but using temporary tables unaware.
– Giancarlo Abel Giulian