SELECT
  s.id AS sessao_id, s.numero, s.tipo, s.data_sessao,
  SUM(q.presente = 1) AS presentes,
  COUNT(q.id) AS registros_quorum
FROM sessoes s
LEFT JOIN quorum q ON q.sessao_id = s.id
WHERE s.data_sessao BETWEEN :data_ini AND :data_fim
GROUP BY s.id, s.numero, s.tipo, s.data_sessao
ORDER BY s.data_sessao DESC, s.id DESC