0
  $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();

I wanted to know whether I have used the FIND_IN_SET and group_by functions correctly. Thanks in advance

julie
  • 111
  • 1
  • 2
  • 13

1 Answers1

3

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

so you should search if a value is != 0

eg:

->where("FIND_IN_SET(s.student_id, a.attendance) !=", 0)
->group_by("a.date")
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • I have applied the suggested solution but if I am adding `,0)` it doesn't show the result. without zero at the end, it works. any suggestion regarding this problem? @scaisEdge – always-a-learner Aug 17 '17 at 07:15
  • @ankitsuthar post a new specific question well documented and with proper code .. and comment me the question link .. so i can evaluate your real situation .. – ScaisEdge Aug 17 '17 at 07:20
  • [Here](https://stackoverflow.com/questions/45729241/difference-between-where-in-and-find-in-set) is the link sir @scaisEdge – always-a-learner Aug 17 '17 at 07:41