【发布时间】:2017-11-03 09:42:03
【问题描述】:
id | name | status
1 | name | yes
2 | name | no
3 | name | yes
如何使用活动记录计算值为 yes 和值为 no 的总状态?喜欢的计数是:yes = 2,no = 1
这是我迄今为止尝试过的
$this->db->select('count(status));
//$this->db->select('count(where status == 'yes')); // not working
$query = $this->db->get();
【问题讨论】:
标签: php mysql codeigniter activerecord