A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2010, 08:18 AM posted to microsoft.public.access.queries
Cecilia
external usenet poster
 
Posts: 47
Default 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  
Old April 21st, 2010, 12:55 PM posted to microsoft.public.access.queries
Kc-Mass
external usenet poster
 
Posts: 362
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.