How i can group my records?

I have this records:

I need to group this records by class_id, so i will be one array with two positions.

I try:

const quizAbertos = await Database



   .where('student_id', idEstudante)

   .where('execution_back_status', 'Enviado Perguntas')


But i’m getting:

select “student_quiz_historics”.* from “student_quiz_historics” where “student_id” = $1 and “execution_back_status” = $2 group by “student_quiz_historics”.“class_id” - column “” must appear in the GROUP BY clause or be used in an aggregate function

What database are you using?

Hey @veronesecoms! :wave:

This is a common SQL issue, I let you read this post for more information.