SELECT
  s.id, s.numero, s.tipo, s.data_sessao, s.status,
  CASE WHEN a.id IS NULL THEN 0 ELSE 1 END AS tem_ata,
  a.id AS ata_id, a.publicar_site AS ata_publicada
FROM sessoes s
LEFT JOIN atas a ON a.sessao_id = s.id
WHERE s.data_sessao BETWEEN :data_ini AND :data_fim
ORDER BY s.data_sessao DESC, s.id DESC