Hello everyone I have a question the question is, I have in the database 3 tables student, tutor and person. Student has foreign keys to person and tutor, my question is, I have problems to bring the name of the tutor, I need the name of the student but also the name of the tutor that is not bringing me, that data is in the person table I put the query I can help me. Thank you!
$this->db->select('alumno.* , persona.name as alumnopersona_name,persona.dni as alumnopersona_dni,persona.cuil as persona_cuil ,curso.name as curso_name, estado_alumno.name as estadoalumno_name, escuela.name as escuela_name, tutor.persona_id as tutorpersona, persona.name as tutorpersona_name');
$this->db->from('alumno');
$this->db->join('persona', 'alumno.persona_id = persona.id', 'left');
$this->db->join('tutor', 'alumno.tutor_id=tutor.id');
$this->db->join('curso','alumno.curso_id= curso.id','left');
$this->db->join('escuela','alumno.escuela_id= escuela.id','left');
$query = $this->db->get();
if ($query->num_rows()>0) {
return $query->result();
}else
{
return FALSE;
}