gpt4 book ai didi

mysql - 在 Codeigniter 中选择 count(*) 和 group_by

转载 作者:太空宇宙 更新时间:2023-11-03 11:16:52 26 4
gpt4 key购买 nike

我有一个库,它使用 mysql 生成带分页的 CRUD,并使用 group_by 创建查询,但是 $ this-> db-> count_all_results () 计数不正确。

我通过更改 CodeIgniter 的功能进行了调整,使用之前的选择

select count (*) from ('. $ this-> db-> _compile_select ().') x'

还有其他建议吗?

最佳答案

您必须在 count_all() 函数之后指定其他参数。

看这个:

$this->db->group_by('my_table_col');
$total = $this->db->count_all('my_table');

克莱伯。

关于mysql - 在 Codeigniter 中选择 count(*) 和 group_by,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4464564/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com