title: getting first row of data from multiple rows with same id codeigniter
body: <p>Been searching for answers to my query error in Codeigniter: I want to get the first row in multiple rows with same id from database. unfortunately, this error always comes up.</p>
  <pre><code>Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'blitzwor_g3d.orders.total_price' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
  </code></pre>
  <p>This is the query from my model:</p>
  <pre><code> public function all()
    {    
      $this-&gt;db-&gt;select('*');
      $this-&gt;filters($this-&gt;table);
      $this-&gt;db-&gt;group_by('order_id');
      $res = $this-&gt;db-&gt;get($this-&gt;table)-&gt;result();
      return $this-&gt;formatData($res);
    }
  </code></pre>
  <p>I've also tried using $this-&gt;db-&gt;distinct() but it does no effect.</p>
  <p>Some blogs recommend to change the sql mode but I can't do that because there are other websites connected to the database and can affect their behavior.</p>
  <p>any way to achieve this?</p>