FIND_IN_SET 在查询中的用法

Usage of FIND_IN_SET in query

  $query=$this->db
->select(a.date,group_concat(s.name)
->from("tbl_attendance a,tbl_students s") 
->WHERE ("FIND_IN_SET(s.student_id, a.attendance)")->group_by("a.date")
->get();

我想知道我是否正确使用了FIND_IN_SET和group_by功能。提前致谢

FIND_IN_SET() returns the position of a string if it is present (as a substring) within a list of strings

因此您应该搜索值是否为 != 0

例如:

->where("FIND_IN_SET(s.student_id, a.attendance) !=", 0)
->group_by("a.date")