TP中统计指定字段的总数
如统计已激活设备数量和未激活设备数量
$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();
-----END
影子是一个会撒谎的精灵,它在虚空中流浪和等待被发现之间;在存在与不存在之间....