J
Jeff
Hi,
I have 2 tables, tbBaby and tbVaccineInjection. tbBaby stores the babies'
personal data like Name, BirthDate etc., tbVaccine stores VaccineName,
DoseNumber (1st, 2nd, 3rd, etc.) and InjectionDate, etc. These 2 tables are
one to many in relation, because each baby may have several vaccinations on
different dates.
I'd like to build a query to retrieve babies with their most recent
injection date, i.e. only one record for each baby with latest injection date.
my query is as follow
SELECT tbBaby.*, tbVaccine.*
FROM tbBaby INNER JOIN tbVaccine ON tbBaby.ID=tbVaccine.BabyID
WHERE tbBaby.BirthDate Between Me!StartDate And Me!EndDate
ORDER BY tbVaccine.InjectDate DESC;
With this query, each baby may have more than one record. I tried to use
DISTINCT or DISTINCTROW, but still unable to get it work. Your help will be
apprecited.
I have 2 tables, tbBaby and tbVaccineInjection. tbBaby stores the babies'
personal data like Name, BirthDate etc., tbVaccine stores VaccineName,
DoseNumber (1st, 2nd, 3rd, etc.) and InjectionDate, etc. These 2 tables are
one to many in relation, because each baby may have several vaccinations on
different dates.
I'd like to build a query to retrieve babies with their most recent
injection date, i.e. only one record for each baby with latest injection date.
my query is as follow
SELECT tbBaby.*, tbVaccine.*
FROM tbBaby INNER JOIN tbVaccine ON tbBaby.ID=tbVaccine.BabyID
WHERE tbBaby.BirthDate Between Me!StartDate And Me!EndDate
ORDER BY tbVaccine.InjectDate DESC;
With this query, each baby may have more than one record. I tried to use
DISTINCT or DISTINCTROW, but still unable to get it work. Your help will be
apprecited.