Subject: Not an Access expert, but I know SQL!
Author:
Posted on: 2015-10-29 03:15:00 UTC
What's the connection between assessments and chemicals? I suspect that each assessment has multiple chemicals involved, but are chemicals referenced by multiple assessments? If so, there should be a third table called a cross table, which is just a giant set of assessment-chemical ID pairs to keep track of what is associated with what.
If there's just one assessment per chemical, you'll want a query that looks something like:
select (a.id) from assessments a
join chemicals c
on c.assessmentid = a.id
where c.hazardous = true;
(The table might be set up the other way around, with a.chemicalid = c.id)
If there are multiple assessments per chemical, and a properly set-up cross table, you'll need something more like:
select (a.id) from assessments a
join crosstable r
on r.assessmentid = a.id
join chemicals c
on r.chemical_id = c.id
where c.hazardous = true;
Hope that helps!