title: view all products using group by in codeigniter
body: <p>i've this client who has a employee list and he wants to display all employees of same category(in group), i'm sorry if i'm not able to explain, i will try to explain</p>
  
  <pre><code>----------------------------
  id | e_id | e_pos   | e_name
  -----------------------------
   1 | 142  |   dev   | abc
   2 | 143  |  sr.dev | bac
   3 | 144  |  intern | jlk
   4 | 145  |   dev   | jlsd
   5 | 146  |   dev   | asdf
   6 | 147  |  sr.dev | adsc
   7 | 148  |  intern | mlkn
   8 | 149  |  sr.dev | vjll
   9 | 150  |   dev   | knmk
  10 | 151  |   dev   | jlkm
  ----------------------------
  </code></pre>
  
  <p>how to show the output</p>
  
  <p><code>Number of dev(5)
   1) abc
   2) jlsd
   3) asdf
   4) knmk
   5) jlkm
   Number of intern(2)
   1) jlk
   2) mlkn
   Number of sr.dev(3)
   1) bac
   2) adsc
   3) vjll
  </code>
  now the problem is i've tried this piece of code</p>
  
  <pre><code>$this-&gt;db-&gt;select('e_id,e_pos,e_name');
  $this-&gt;db-&gt;group_by('e_pos');
  $query = $this-&gt;db-&gt;get('emp'); // table name
  if($query-&gt;num_rows() &gt; 0)
  {
      return $query-&gt;result();
  }
  </code></pre>
  
  <p>but the above code is not working, it's just showing dev and number of dev, i want to see all dev data.</p>
  
  <p><code>dev</code></p>
  
  <p><strong>I'm using Codeigniter 2.2.0</strong></p>