I want year in one table to be less or equal year in another table

C

Cecilia

Hi

I have some problems writing a query and I hope someone can help me.

I have a database with serveal tables. In one table I have this information,
Lake ID-number, treatment, year for treatment. In another table I have Lake
ID-number, fish species (I am intrested in pike), year when pike is present.
I want to find all lakes that have pike present before the treatment was
done, I want the year in the second table to me less or equal the year in the
first table. Is there a easy way to do this?

Thanks
 
K

kc-mass

Try something like this substituting your table and field names.

SELECT tblTreatments.DateTreated, Year([DatePresent]) AS YearSpeciesPresent,
tblSpecies.Species
FROM tblTreatments INNER JOIN tblSpecies ON tblTreatments.LakeID =
tblSpecies.LakeID
WHERE (((Year([DatePresent]))<=Year([DateTreated])) AND
((tblSpecies.Species)="Pike"));

Regards

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top