SELECT Visits.KHA_ID, tblKentuckyCounties.countyName, tblHospitals.HospitalName, hospitalCounties.countyName
FROM (HospitalType INNER JOIN (hospitalCounties
INNER JOIN
tblHospitals ON hospitalCounties.countyID = tblHospitals.countyFK) ON HospitalType.HospitalTypeID = tblHospitals.HospitalTypeFK)
INNER JOIN
(tblKentuckyCounties INNER JOIN Visits ON tblKentuckyCounties.countyID = Visits.PAT_COUN)
ON tblHospitals.Hosp_ID = Visits.HospitalID;
这是一个查询,它将返回患者来自的县,以及他们被看到的医院。工作良好。但是,如何才能使得唯一返回的结果是县的不同之处?我假设这是'where'关键字的使用位置?
答案 0 :(得分:1)
假设......
...添加一个WHERE子句......
WHERE tblKentuckyCounties.countyName <> hospitalCounties.countyName