$consulta = DB::Select('
SELECT nombrePerfilCargo, idPerfilCargo,porcentajeCargoHabilidad,porcentajeHabilidadCargo,c.Compania_idCompania
FROM cargo c
LEFT JOIN cargohabilidad ch
ON c.idCargo = ch.Cargo_idCargo
LEFT JOIN perfilcargo pc
ON ch.PerfilCargo_idPerfilCargo = pc.idPerfilCargo
WHERE idCargo = '.$idCargo and 'c.Compania_idCompania = '.\Session::get('idCompania'));
Can someone tell me what the syntax is like after the first condition of WHERE
to add a second AND
...
WHERE idCargo = '.$idCargo and 'c.Compania_idCompania = '.\Session::get('idCompania'));
to add the Session::get
?
I'm getting a syntax error:
SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 (SQL: 1)