title: calculate average of a specific column in codeigniter select query
body: <p>I want to calculate average of a specific column, for eg. rating column for that i am writing the following query but it is giving me syntax error in the query, Please help to solve my problem. </p>
  
  <pre><code>$this-&gt;db-&gt;select('*, AVG(`rating`) As avg_r');
  </code></pre>