title: Codeigniter group_by and Order_by conflict
body: <p>I am currently working on a Codeigniter query where I attemt to get a bunch of results. However, when I use both group_by and order_by within the same query, the order_by gets overruled and does not apply for some reason.</p>
  
  <p>The query is the following:</p>
  
  <pre><code>$this-&gt;db-&gt;select('q.questionNumber, qa.qaId')-&gt;from('questions q');
  $this-&gt;db-&gt;join('questionAnswers qa', 'qa.questionId = q.questionId');
  $this-&gt;db-&gt;where('customerId', $customerId);
  $this-&gt;db-&gt;order_by('q.questionNumber', 'desc');
  $this-&gt;db-&gt;group_by('q.subject');
  $query = $this-&gt;db-&gt;get();
  $query-&gt;result();
  </code></pre>