Limiting Query by date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Thanks in advance for your help!

I have 2 tables: Activity and Correspondence. The relationship between the
two is a one-to-many. For each activity, there could be multiple
correspondences. On the Correspondence table the fields are:
- CorrespondenceNumber (primary key)
- Name
- ContactDate
- Results

I want to create a query that for each activity will give me only 1 item
from the correspondence table -- the one with the newest date. And if there
hasn't been any correspondence for an activity I don't want it to show up on
the query results at all. Any ideas?

Thanks!
Heather
 
Your Correspondence table is missing the foreign key the relates it to the
Activity table.
 
There is a foreign key (I just forgot to write it). They're related by the
ActivityID.

Activity Table
- ActivityID** (primary key)

Correspondence Table
- CorrespondenceNumber ** (primary key)
- ActivityID ** (primary key)
- Name
- ContactDAte
- Results

Thanks!
Heather
 

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

Similar Threads

Min Query 2
Can't edit my query 2
Limiting multiple results in query 7
Multiple Dates in a table 1
Append Query problem 2
multiple one to many 2
Verify data via query 1
Query Totals 3

Back
Top