$subject_list = ClassSubjectList::groupBy('class','group')->get();
above line of code giving me error i don't understand
error message:
SQLSTATE[42000]: Syntax error or access violation: 1055 'bncd_db.class_subject_lists.id' isn't in GROUP BY (SQL: select * from
class_subject_lists
group byclass
,group
)
ClassSubjectList model
class ClassSubjectList extends Model
{
protected $table = 'class_subject_lists';
protected $fillable = [
'class','group','subject'
];
}
table structure
Schema::create('class_subject_lists', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('class');
$table->string('group')->nullable();
$table->string('subject');
$table->timestamps();
});
function
$subject_list = ClassSubjectList::groupBy('class','group')->get();
return $subject_list;