database - Access query select -


i need query on access database don't know how do. have database table diseases stores diseases names , id 1 called symptoms stores symptoms names , id, , 1 called symptomsdiseases associate symptoms given disease. want diseases have given set of symptoms example diseases symptoms id 3, 4 , 5. sql query should solve this? these tables , fields:

1) diseases

iddisease

diseasename

2) symptoms

idsymptom

symptonname

3) symptomsdiseases

iddiseases_fk

idsymptoms_fk

=> in table have example:

iddisease_fk || idsymptoms_fk

6 || 4

6 || 5

6 || 3

6 || 7

6 || 8

4 || 10

4 || 11

4 || 4

4 || 5

4 || 3

this type of technique called relational division

select  a.iddisease,         a.diseasename    diseases         inner join symptomsdiseases b             on a.iddisease = b.iddiseases_fk   b.idsymptoms_fk in (3,4,5)               -- <<== list of id of symptoms group   a.iddisease, a.diseasename having  count(*) = 3                             -- <<== number of symptoms 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -