Steven Deetz
Registered User.
- Local time
- Today, 01:50
- Joined
- Jul 19, 2001
- Messages
- 49
I am developing a membership database and am trying to incorporate a yearly phenomenon with our members. Many head south during the winter months for warmer climates and return in the spring. For our members to continue receiving their newsletter I could just have the database user go in and change the complete address of each member when they head south and change the address back when the member heads north. This is not very elegant.
I have created a Member table with a MemberId primary key and an Address table with both an AddressID and a MemberId. There is a relationship created where one member can have many addresses. In the Address table I also have a DateUpdated field. My reasoning goes that a user will change the DateUpdated field for each member only when each member will head south and when each member will return.
The problem is trying to have a query list only the "current" address. I have one query that looks at the address table and lists only those addresses where DateUpdated<=Date(). I can also create another query based on the first query's results that list the MemberId and the DateUpdated where the query pulls only the Max of the DateUpdated..
What I want to do next, but am truly stumped, is to find the AddressId for each MemberId and MaxOfDateUpdated. I think a subquery might be the answer, but I am not sure.
Thanks for any suggestions or ideas!
I have created a Member table with a MemberId primary key and an Address table with both an AddressID and a MemberId. There is a relationship created where one member can have many addresses. In the Address table I also have a DateUpdated field. My reasoning goes that a user will change the DateUpdated field for each member only when each member will head south and when each member will return.
The problem is trying to have a query list only the "current" address. I have one query that looks at the address table and lists only those addresses where DateUpdated<=Date(). I can also create another query based on the first query's results that list the MemberId and the DateUpdated where the query pulls only the Max of the DateUpdated..
What I want to do next, but am truly stumped, is to find the AddressId for each MemberId and MaxOfDateUpdated. I think a subquery might be the answer, but I am not sure.
Thanks for any suggestions or ideas!