我有兩個表clinical_study和location_countries,他們都有NCT_ID(臨牀試驗)領域的共同點,我必須從兩個表中拉數據應用條件在第一個表(性別),然後又檢查了第二個表的國家比賽, 我成功設法運行下面的查詢,但其在鄉間田野我得到英國和其他國家SQL Server加入兩個表與哪裏條件在這兩個表上
select
clinical_study.NCT_ID, clinical_study.BRIEF_SUMMARY, clinical_study.STUDY_TYPE, clinical_study.GENDER, location_countries.COUNTRY
from clinical_study
inner join location_countries
ON clinical_study.NCT_ID=location_countries.NCT_ID
where clinical_study.GENDER LIKE'Male' or clinical_study.GENDER like 'Both'
and location_countries.COUNTRY ='United Kingdom'
NCT_ID ..... BRIEF_SUMMARY ..... STUDY_TYPE ..... GERER ..... COUNTRY
xys ........ xyz ............... xyz .. ..........都.......英國
xys ........ xyz ............... xyz ........... .Male .......法國
xys ........ xyz ............... xyz .......... ..Male .......英國
xys ........ xyz ............... xyz ........ ....男.......瑞典
請你的意見,如果我在這裏缺少一個竅門
這工作,這是支架,謝謝大家 –