Select records from tble-A where no records in tbl-b meeting crit.

G

Guest

I have a one to many relationship between table-A and table-B. I need to
list records from table-A where records from a selected group of records in
table-B are not found. Ex. Members and MembershipDues Tables. Want to
determine which members have not paid their quarterly dues.
 
J

John W. Vinson

I have a one to many relationship between table-A and table-B. I need to
list records from table-A where records from a selected group of records in
table-B are not found. Ex. Members and MembershipDues Tables. Want to
determine which members have not paid their quarterly dues.

A NOT EXISTS clause will help here:

SELECT TableA.<whatever fields you want to see>
FROM TableA
WHERE NOT EXISTS
(SELECT MemberID FROM TableB WHERE TableB.MemberID = TableA.MemberID
AND <whatever other criteria you want>)


John W. Vinson [MVP]
 
M

Marshall Barton

Ellen said:
I have a one to many relationship between table-A and table-B. I need to
list records from table-A where records from a selected group of records in
table-B are not found. Ex. Members and MembershipDues Tables. Want to
determine which members have not paid their quarterly dues.


SELECT M.MemberName, M.MemnerAddress, . . .
FROM Members As M LEFT JOIN MembershipDues As D
ON <M.ID = D.MemberID
WHERE D.MemberID Is Null
AND D.PaidDate >= quarterstartdate
 

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

Top