Hey guys Im new to laravel. I have this table
How will i able to fetch count of 'is_correct' column for each subject?
Thanks guys!
Try this, replace the Model with your eloquent model name
Model::select( 'subject_id', IlluminateSupportFacadesDB::raw("COUNT(is_correct) as count") ) ->groupBy('subject_id') ->get();
2.1m questions
2.1m answers
60 comments
57.0k users