If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
I want year in one table to be less or equal year in another table
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 |
#2
|
|||
|
|||
I want year in one table to be less or equal year in another table
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 "Cecilia" wrote in message ... 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 |
Thread Tools | |
Display Modes | |
|
|