嘿我有以下问题:
我有一个很长的 MySQL 查询,然后我想计算它返回的行数。
得到这个结果后,我想用一些限制再次制作它,并将我的结果按一列分组。
所以看起来:
/*
query conditions....
query conditions....
query conditions....
query conditions....
query conditions....
query conditions....
query conditions....
*/
//first query
$query = $this->db->get();
$results = $query->result_array();
$this->db->select("FOUND_ROWS() as cnt");
$cnt_array = $this->db->get()->row_array(); //here is my number of rows
//second query and if instruction
if($sth==0) { $this->db->group_by(...);}
$this->db->limit($count, $from);
$query = $this->db->get();
$results = $query->result_array();
$this->db->select("FOUND_ROWS() as cnt");
$tot_cnt = $this->db->get()->row_array(); //now i want to have number of grouped results.
但是第二个查询不起作用,怎么办?