TP中统计指定字段的总数
程序员文章站
2022-03-25 17:24:57
如统计已激活设备数量和未激活设备数量 $condition = [ ['member_id', '=', $member_id] ]; $field = [ 'COUNT(IF(active_member_id > 0, 1, null)) as actived_num', 'COUNT(IF(ac ......
如统计已激活设备数量和未激活设备数量
$condition = [ ['member_id', '=', $member_id] ]; $field = [ 'count(if(active_member_id > 0, 1, null)) as actived_num', 'count(if(active_member_id = 0, 1, null)) as unactived_num', ]; $list = $this->where($where)->field($field)->order($order)->select();
上一篇: 榴莲壳的用处多多,吃榴莲又有什么好处
下一篇: Python -- CSV文件读写