开发者

select count(*) with group_by in Codeigniter

开发者 https://www.devze.com 2023-01-31 12:42 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消