title: How to use FIND_IN_SET() query in codeigniter
body: <p>I have two tables- One with attendance details and another one with student detail. The following are the table structures:</p>
  
  <h2>tbl_attendance</h2>
  
  <p>aid &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; date      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  attendance&nbsp;&nbsp;&nbsp;&nbsp;            </p>
  
  <p>1  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2017-03-09&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,6,9  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
   2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   2017-04-06 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12,6,10       </p>
  
  <h2>  tbl_students</h2>
  
  <p>student_id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  name </p>
  
  <p>5       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      John<br>
  6 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bryan</p>
  
  <p>9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Anna</p>
  
  <p>10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mathew</p>
  
  <p>12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Susan</p>
  
  <p>Now, I want to display the names of the absentees in the view  as something like say. for example:</p>
  
  <p>Date &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Absentees</p>
  
  <p>2017-03-09 &nbsp;&nbsp;John, Bryan, Anna</p>
  
  <p>2017-03-06 &nbsp;&nbsp;Susan, Bryan, Mathew</p>
  
  <p>I was trying to do it with FIND_IN_SET()..but it seems bad luck..Is there a better way to sort this out?</p>
  
  <h2>UPDATE</h2>
  
  <p>I used this query instead and it echoed only the first id's name in each row...</p>
  
  <pre><code>    $query = $this-&gt;db
     -&gt;select("tbl_attendance.*,tbl_students.name")
     -&gt;from("tbl_attendance")
     -&gt;join("tbl_students","tbl_students.student_id=tbl_attendance.attendance")
     -&gt;where('FIND_IN_SET(tbl_students.student_id, tbl_attendance.attendance)')
     -&gt;GROUP_BY('tbl_students.student_id')
     -&gt;get()-&gt;result_array(); 
  </code></pre>
  
  <p>But as there are three numbers separated by commas in each row I want the rest to be echoed as well.</p>