J
Jeff
Hi everyone,
I have a database that keep records of vaccination for children. There are
two tables, tblMatser keeps the personal profile of children, tblVaccine
keeps the vaccination record such as date of vaccination, vaccine name &
vaccine dose number etc. The relation between tblMaster and tblVaccine is one
to many. I’d like to build a query to retrieve those children who have
received VaccineA dose 1 but not yet VaccineA dose 2. I know I have to
retrieve a population who have received VaccineA dose 1 first (this
population may include those who have both VaccineA dose 1 & dose 2), then
from this population I sort out those who haven’t received VaccineA dose 2.
Can anyone tell me how to do this? Thank you very much.
My query will be something like:
SELECT *
FROM tblMaster
WHERE tblMaster.ID IN (SELECT tblMaster.ID FROM tblMaster LEFT JOIN
tblDetail ON tblMaster.ID = tblDetail.MasterID WHERE tblDetail.Vacc =
"VaccineA" And tblDetail.VaccNth <>"2") ---ïƒ ???
(SELECT tblMaster.ID FROM tblMaster LEFT JOIN tblDetail ON tblMaster.ID =
tblDetail.MasterID WHERE tblMaster.BabyBirth Between
[Forms]![qryForm].[birthdate1] And [Forms]![qryForm].[birthdate2] AND
tblDetail.Vacc = "VaccineA" And tblDetail.VaccNth = "1");
I have a database that keep records of vaccination for children. There are
two tables, tblMatser keeps the personal profile of children, tblVaccine
keeps the vaccination record such as date of vaccination, vaccine name &
vaccine dose number etc. The relation between tblMaster and tblVaccine is one
to many. I’d like to build a query to retrieve those children who have
received VaccineA dose 1 but not yet VaccineA dose 2. I know I have to
retrieve a population who have received VaccineA dose 1 first (this
population may include those who have both VaccineA dose 1 & dose 2), then
from this population I sort out those who haven’t received VaccineA dose 2.
Can anyone tell me how to do this? Thank you very much.
My query will be something like:
SELECT *
FROM tblMaster
WHERE tblMaster.ID IN (SELECT tblMaster.ID FROM tblMaster LEFT JOIN
tblDetail ON tblMaster.ID = tblDetail.MasterID WHERE tblDetail.Vacc =
"VaccineA" And tblDetail.VaccNth <>"2") ---ïƒ ???
(SELECT tblMaster.ID FROM tblMaster LEFT JOIN tblDetail ON tblMaster.ID =
tblDetail.MasterID WHERE tblMaster.BabyBirth Between
[Forms]![qryForm].[birthdate1] And [Forms]![qryForm].[birthdate2] AND
tblDetail.Vacc = "VaccineA" And tblDetail.VaccNth = "1");