I have two tables.
diseases
-----------------------------
| ID | NAME |
-----------------------------
| 1 | Disease 1 |
| 2 | Disease 2 |
| 3 | Disease 3 |
疾病症状
-----------------------------
| DISEASE_ID | SYMPTOM_ID |
-----------------------------
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 1 | 4 |
| 2 | 1 |
| 2 | 2 |
我希望选择所有具有症状1或2和3或4的疾病。
我尝试过:
SELECT *
FROM diseases_symtoms
WHERE (symptoms = '1' OR symptoms = '2')
AND (symptoms = '3' OR symptoms = '4')
并且:
SELECT *
FROM diseases_symtoms
WHERE symptoms IN ('1','2')
AND symptoms IN ('3','4')
...但它并没有起作用。