开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜