Please what will be the right way to write this query using active-record

Hello guys,

Trust you all good. Please i need your help, i am trying to do a query using active-record


id, quiz_id, homework_id, student_id, question_id, selected,answer,topic_id,created_at




I want to find the best performing topic

below is the code i wrote that doesnt work


->innerJoin(‘homeworks’, ‘quiz_summary_details.homework_id =’)

->where([‘homeworks.class_id’ =>$id])




Please whats the right way to achieve this?