Select query

  • Thread starter Thread starter Ting
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top