Select query

T

Ting

I am working on a donor tracking system and need to pull up
all donors who have given before 9/30/99 but have not
donated again since. Any clue would be greatly
appreciated. Thanks in advance
 
D

Dale Fye

Ting,

Depends on your data structure, but something like the following
should work:

SELECT D.*
FROM Donors D
WHERE D.DonorID
NOT IN (SELECT DISTINCT DonorID
FROM Donations
WHERE DonationDate >= #9/30/1999#)

This assumes that you have a Donors table and a Donations table where
the joining field would be DonorID.


--
HTH

Dale Fye


I am working on a donor tracking system and need to pull up
all donors who have given before 9/30/99 but have not
donated again since. Any clue would be greatly
appreciated. Thanks in advance
 
T

Ting

Thanks Dale, looks like it should work but it doesn't.
Here's my code, what's wrong with it?
SELECT Gifts.[ID Number], Gifts.[Gift ID], Gifts.[Gift
Date], Gifts.[Gift Amount], Gifts.[Gift Type], Gifts.[Gift
Class], Gifts.[Chk Number], Gifts.Restrictions
FROM Gifts
WHERE Gifts.[ID Number] NOT IN (SELECT DISTINCT ID Number
FROM Gifts
WHERE Gifts.[Gift.Date] >=#9/30/1999#);
Ting
 
T

Ting

Hi Dale,
I found and fixed some syntax errors, and it works
beautifully. Thanks for your help, I need to be more
careful when typing.
I hope you have a nice day.
Ting
 

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