Well, I am trying to filter the duplicates of a table with grocery and it seems that it completely ignores my query, I have tried with distinct()
, group by()
and even both at the same time.
What I want is to show the table without duplicates.
What am I doing wrong?
Controller
$this->Fechacita_Model->delete_duplicaterow();
Model
public function delete_duplicaterow() {
$this->db->select('c.intervaloHorario', 'ci.cita');
$this->db->distinct();
$this->db->from('intervaloshorarios c');
$this->db->join('citas ci', 'c.idIntervaloHorario = ci.idIntervaloHorario', 'right');
$this->db->group_by('c.intervaloHorario','ci.cita');
$query = $this->db->get();
return $query->num_rows();
}
DB