Join CodeIgniter

1

Next, I have a vague table and other vaga_cadidato, I would like to select the data of the same ones when the id_entidade is equal in the id_entidade. But it is showing me only the data of the vacant table, I would like that in this same query to show the data of the vacant_candidato. Follow my query.

function vagaDaEntidade(){
  $status = 'Aguardando Reposta';
  $id_entidade = $this->session->userdata('id_entidade');
  $this->db
  ->select("*")
  ->from("vaga")
  ->join('vaga_candidato', 'vaga.id_vaga = vaga_candidato.id_vaga')
  ->where('status_vaga', $status);


  return $query = $this->db->get()->result();
}

I welcome everyone.

    
asked by anonymous 23.09.2016 / 05:28

1 answer

1

Specify the tables in select . Try this way it will work:

$this->db
  ->select("vaga.*, vaga_candidato.*")
  ->from("vaga")
  ->join('vaga_candidato', 'vaga.id_vaga = vaga_candidato.id_vaga')
  ->where('status_vaga', $status);

Just that!

    
27.09.2016 / 15:51