title: How to use GROUP BY with Firebird?
body: <p>I'm trying create a SELECT with GROUP BY in Firebird but I can't have any success. How could I do this ?</p>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>Can't format message 13:896 -- message file C:\firebird.msg not found.
  Dynamic SQL Error.
  SQL error code = -104.
  Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause).
  (49,765 sec)
  </code></pre>
  
  <p><strong>trying</strong></p>
  
  <pre><code>SELECT FA_DATA, FA_CODALUNO, FA_MATERIA, FA_TURMA, FA_QTDFALTA,
                 ALU_CODIGO, ALU_NOME,
                 M_CODIGO, M_DESCRICAO,
                 FT_CODIGO, FT_ANOLETIVO, FT_TURMA
                 FROM FALTAS Falta
                 INNER JOIN ALUNOS Aluno ON (Falta.FA_CODALUNO = Aluno.ALU_CODIGO)
                 INNER JOIN MATERIAS Materia ON (Falta.FA_MATERIA = Materia.M_CODIGO)
                 INNER JOIN FORMACAOTURMAS Turma ON (Falta.FA_TURMA = Turma.FT_CODIGO)
                 WHERE (Falta.FA_CODALUNO = 238) AND (Turma.FT_ANOLETIVO = 2015) 
                 GROUP BY Materia.M_CODIGO
  </code></pre>