查询MySQL数据库

时间:2013-03-01 08:37:48

标签: mysql phpmyadmin

有人可以帮助我在此查询中添加包含疾病风险因素的第三个表格。该表是tblRiskFactors

SELECT tblDiseases.disease
FROM tblRel 
   LEFT JOIN tblDiseases ON tblRel.diseaseID = tblDiseases.diseaseID
WHERE tblRel.symptomID = '1' AND tblRel.symptomID = '2' AND tblRel.symptomID ='3'

2 个答案:

答案 0 :(得分:0)

SELECT  tblDiseases.disease
FROM    tblRel 
        LEFT JOIN tblDiseases 
            ON tblRel.diseaseID = tblDiseases.diseaseID
        LEFT JOIN tblRiskFactors
            ON -- define the linking condition here
WHERE   tblRel.symptomID = '1' AND 
        tblRel.symptomID = '2' AND 
        tblRel.symptomID = '3'

要进一步了解联接,请访问以下链接:

答案 1 :(得分:0)

SELECT tblDiseases.disease as disease 
FROM tblRel 
   LEFT JOIN tblDiseases ON tblRel.diseaseID = tblDiseases.diseaseID
   LEFT JOIN tblRiskFactors ON tblRel.relation_column = tblRiskFactors.relation_column
WHERE tblRel.symptomID in (1,2,3)