I hope to explain myself well and that you can help me, thanks in advance, the situation is as follows:
I am developing a system that diagnoses computer failures, which will work in the following way, the user will select several symptoms and according to these symptoms the system will tell you what has (or can have) your PC, for that I have 3 tables, the table FAILS the table SYMPTOMS and one that I called SYMPTOM_FACE which is the link of the previous 2 since I manage it as a many to many relationship (a fault can have several symptoms and a symptom in turn can belong to several faults), the point is that I need to get the fault that matches the symptoms sent by the user; something like this:
the FALLA table has 2 fields: ID, DESCRIPTION
the symptoms table also has: ID, DESCRIPTION
the SYMPTOM-FAIL table has: ID, FAULT, SYMPTOM
Suppose that the user selects the symptoms: "the pc does not start (whose id is 2)" and "abnormal beeps are heard (id 4)",
I tried something like this:
Select f.descripcion as falla, s.descripcion as sintoma
from sintoma_falla sf
inner join falla f
on f.id=sf.falla
inner join sintoma s
on s.id=sf.sintoma
WHERE sf.sintoma=2 and sf.sintoma=4
But it does not work, The result I want is: the name of the fault that matches all the selected symptoms.
again thanks and I hope you can help me.