select count(*) with group_by in Codeigniter
I have a library That generates a CRUD with pagination using mysql and created a query with group_by, but the $ this-> db-> count_all_results () is not counted correctly.
I 开发者_开发百科made an adjustment by changing the function of the CodeIgniter for an alternative, using the previous select
select count (*) from ('. $ this-> db-> _compile_select ().') x'
Anyone have other suggestions?
You must especify other params after the count_all() function.
Look this:
$this->db->group_by('my_table_col');
$total = $this->db->count_all('my_table');
Cleber.
精彩评论