tableName . '`.*, ' . '(' . 'SELECT COUNT(*) FROM `' . $this->db->tblContactPerson2Group. '` AS `ContactPerson2Group` ' . 'JOIN `' . $this->db->tblContactPerson . '` AS `ContactPerson` ' . 'ON `ContactPerson`.`id` = `ContactPerson2Group`.`id_person` ' . 'WHERE `ContactPerson2Group`.`id_group` = `' . $this->tableName . '`.`id`' . ') as person_count '; return $sql; } function delete() { $this->deleteIds($this->db->tblContactPerson2Group, 'id_group'); parent::delete(); } }