vendredi 20 décembre 2019

how to select sum while the filed have a value 0 and 1?

hi guys i want to sum the field while my column is_active is 0 and i want to show it to my dashboard page and if is_active is 1 they will skip and not sum how to do it? whats the query? i have my example query i build in codeigniter

$this->db->select_sum('is_active');
    $query = $this->db->get('postfes');
    if ($query->num_rows() = 0) {
        return $query->num_rows()->is_active;
    } else {
        return 0;
    }

thats my query code im sorry for my bad english




Aucun commentaire:

Enregistrer un commentaire