当前位置: 移动技术网 > IT编程>开发语言>PHP > TP中统计指定字段的总数

TP中统计指定字段的总数

2020年01月07日  | 移动技术网IT编程  | 我要评论

如统计已激活设备数量和未激活设备数量

$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();
            

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网