$this->db->query(" SELECT d.nm_pt, d.kd_pt , a.status, count(a.status) from tbl_mahasiswa_transaksi a JOIN tbl_mahasiswa b ON a.nim = b.nim JOIN tbl_pendaftar c on b.no_pendaftaran = c.no_pendaftaran JOIN tbl_pt d ON d.kd_pt = c.kd_pt WHERE d.kd_pt = $kode_pt GROUP BY a.status,kd_pt "); Answer :