473,387 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Test all records in a many to one linked records

Access 2002:

Example:
Master record: ID#, Name
Linked records: ID#, Member year
If a member for the last 3 years you have 3 linked records withmember year =
2002, 2003, and 2004.
I want to find all ID#'s that were members in 2003 but NOT 2004.
A query for member year = 2003 and <> 2004 yields ALL 2003 records because
the 2003 record = 2003 and NOT 2004.
How can the query look at all the linked records at the same time for a
valid test?

Phil Abrahamsen
ph**@bowersoc.com

--
----------------------------------------------------
This mailbox protected from junk email by MailFrontier Desktop
from MailFrontier, Inc. http://info.mailfrontier.com
Nov 13 '05 #1
1 1471
In essence, you need to create subselects of the 2003 members and the 2004
members and join them.

The following SQL is untested aircode:

SELECT A.ID, A.[Name]
FROM
(SELECT ID, [Name]
FROM Master INNER JOIN Linked
ON Master.ID = Linked.ID
WHERE Linked.MemberYear = 2003) AS A
LEFT JOIN
(SELECT ID, [Name]
FROM Master INNER JOIN Linked
ON Master.ID = Linked.ID
WHERE Linked.MemberYear = 2004) AS B
ON A.ID = B.ID
WHERE B.ID IS NULL
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Phil Abrahamsen" <ph**@abrahamsens.com> wrote in message
news:d1********@dispatch.concentric.net...
Access 2002:

Example:
Master record: ID#, Name
Linked records: ID#, Member year
If a member for the last 3 years you have 3 linked records withmember year
=
2002, 2003, and 2004.
I want to find all ID#'s that were members in 2003 but NOT 2004.
A query for member year = 2003 and <> 2004 yields ALL 2003 records because
the 2003 record = 2003 and NOT 2004.
How can the query look at all the linked records at the same time for a
valid test?

Phil Abrahamsen
ph**@bowersoc.com

--
----------------------------------------------------
This mailbox protected from junk email by MailFrontier Desktop
from MailFrontier, Inc. http://info.mailfrontier.com

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: deko | last post by:
I have a form with a subform datasheet - I need code behind the OnDelete event of the subform: Private Sub Form_Delete(Cancel As Integer) 'do something that depends on which record is deleted...
15
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? ...
2
by: csgraham74 | last post by:
Hello, im using MS Access as a front end to link to MYSQL. although this is possibly an Access issue i thought someone would be able to help me. the error message "ODBC--insert on a linked table...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
4
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that...
6
by: gerbski | last post by:
Hi all, I am relatively new to ADO, but up to now I got things working the way I wanted. But now I've run into somethng really annoying. I am working in MS Access. I am using an Access...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
5
by: Neil | last post by:
I'm running Access 2000 with a SQL 7 back end, using ODBC linked tables in an MDB file. The db is used by about 30 users on a LAN, and an additional 10 or so on a WAN. Recently, one of the WAN...
6
by: scott.tang | last post by:
I'm experiencing a very strange problem. My application is MS Access front-end and MS SQL server back-end database. I have a SQL statement that deletes records from a table after an export...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.