Error 1054 in Database

0

A Database Error Occurred Error Number: 1054

  

Unknown column 'referencia.idReferencia' in 'on clause'       SELECT os . , clientes . , facas . , usuarios . email , usuarios . nome , referencia . FROM os JOIN clientes ON clientes . idClientes = os . clientes_id JOIN usuarios ON usuarios . idUsuarios = os usuarios_id = facas . facas JOIN idFacas ON os . faca_id = referencia . referencia WHERE idReferencia . os = '27' LIMIT 1       Filename: models / Os_model.php       Line Number: 96

File containing the Function:

function getById($id){
    $this->db->select('os.*, clientes.*, facas.*, usuarios.email, usuarios.nome, referencia.*');
    $this->db->from('os');
    $this->db->join('clientes','clientes.idClientes = os.clientes_id');
    $this->db->join('usuarios','usuarios.idUsuarios = os.usuarios_id');
    $this->db->join('facas','facas.idFacas = os.faca_id');
    $this->db->join('referencia','referencia.idReferencia = os.referencia_id');
    $this->db->where('os.idOs',$id);
    $this->db->limit(1);
    return $this->db->get()->row();
}

There is the column reference_id in BD.

What can it be?

    
asked by anonymous 29.07.2018 / 00:13

1 answer

0

You could have passed the diagram of the tables ...
But I think the problem with your join is that idReference might not exist, see if that is, try to run this Query manually in your DBMS ( System Database Manager) Remember to change idReference if it does not exist in the query

Query

        SELECT O.*,C.*,F.*,U.EMAIL,U.NOME,RE.* FROM
            OS O,
            CLIENTES C,
            FACAS F,
            USUARIOS U,
            REFERENCIA RE
        WHERE
        C.idClientes = O.clientes_id AND 
        U.idUsuarios = O.usuarios_id AND
        F.idFacas = O.faca_id AND
        RE.idReferencia = O.rederencia_id AND --veja se idReferencia existe na tabela referencia
        O.idOs = 1 ; --AO INVES DE 1 RODAR ID PRETENDIDO
    
29.07.2018 / 05:51