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 do I have ?
(question mark) I would like to pass the Third party code to correctly pick up the percentage of attendance at the meetings, how could I do this? If I put a fixed value it works, but then all lines appear only from a third party.