select distinct gevtestados.codest,nomest,count(codevepar) as cantidad,'' as vacio  from gevtestados,gevtparticipantes as t2,gevmdeventosparticipantes where (gevtestados.codest=t2.codest) and (t2.codpar=gevmdeventosparticipantes.codpar) and (codeve='@1') and (stainc='S') and (  (((gevmdeventosparticipantes.tippre='S') or (gevmdeventosparticipantes.tippre='P')) and (stapatinc='S')) or ((tippre='N')) ) group by t2.codest 