【发布时间】:2019-08-01 12:36:36
【问题描述】:
我已经制作了这个函数来获取基于 group_id 的人口百分比总和为 1,2 和 3,但它不起作用
public function ethnicity($value='')
{
$this->db->select('SUM(population_percent) as p1 where group_id=1,SUM(population_percent) as p2 where group_id=2,SUM(population_percent) as p3 where group_id=3', FALSE);
$this->db->from('ethnic_group');
$data=$this->db->get()->row_array();
return $data;
}
【问题讨论】:
-
你不能在
select中通过where参考CI活动记录指南。
标签: mysql codeigniter activerecord