Codeigniter: how to select_avg of multiple columns
I just started with codeigniter and I'm stuck in my database query. I created a simple survey and I want to get the average of the columns. Right now I'm doing it like this to test it:
for($x=1;$x<=5;$x++){
$this->db->select_avg('q'.$x , 'averageq'.$x);
}
$this->db->where('sex','male');
$query = $this->db->get('survey');
$data = $query->row_array();
print_r($data);
The survey will comprise of 30+ questions, is there a shorter way getting the the average of each column? something like:
select_avg('all columns in my answers table);
thank you