First of all, explain what I am trying to do so that you understand my problem. I am developing a web platform based on PHP to perform the maintenance of the different types of equipment that may be in an empesa (High, low and modification thereof)
My problem is that I have SIM data in one table, in another data phone and finally phone types. The phone and SIM tables are related by the idSIM. Since there are telephones that do not have any assigned SIM, I want to show them in the phone list, but with the current SQL they do not come out (since a condition is that the idSIM matches) Current SQL:
SELECT *
FROM
Telefonia_Equipamiento,
Equipamiento_TipoTelefono,
SIM_Equipamiento
WHERE
Telefonia_Equipamiento.activo = 1
AND
Telefonia_Equipamiento.tipoTelefono = Equipamiento_TipoTelefono.idTipo
AND
Equipamiento_TipoTelefono.descripcion='Empleados'
AND
Telefonia_Equipamiento.idSIM = SIM_Equipamiento.idSIM
ORDER BY
Telefonia_Equipamiento.idTelefonia";
I'm trying to make a left join to show the phones that do not have SIM, but I get the error of the title
SQL with Left Join:
SELECT *
FROM
Telefonia_Equipamiento,
Equipamiento_TipoTelefono
LEFT JOIN
SIM_Equipamiento
ON
Telefonia_Equipamiento.idSIM=SIM_Equipamiento.idSIM
WHERE
Telefonia_Equipamiento.activo = 1
AND
Telefonia_Equipamiento.tipoTelefono = Equipamiento_TipoTelefono.idTipo
AND
Equipamiento_TipoTelefono.descripcion='Empleados';
If you need more information, data or whatever, do not hesitate to ask me. Thanks in advance