Table 1 is called DATA and contains names, address info
and Table2 is called DONATIONS and contains donations (amount, check number, etc).
I have a query with a one-to-many relationship (on the field "KEY"). So any one person can have multiple donations. What I am trying to do is send a letter "Dear John Smith, Last year you donated $10.00..."
Right now it IS pulling in everyone who has not donated... However, the query is pulling up "John Smith's" donation from 2008, 2007, and so on. How can I get it to pull up only his last donation and still pull up those who have never donated?
FYI This query also filters out those with ACCT below 99 and EXP_YEAR above 2007 - so I am only sending to current members. This aspect is working well.
and Table2 is called DONATIONS and contains donations (amount, check number, etc).
I have a query with a one-to-many relationship (on the field "KEY"). So any one person can have multiple donations. What I am trying to do is send a letter "Dear John Smith, Last year you donated $10.00..."
Right now it IS pulling in everyone who has not donated... However, the query is pulling up "John Smith's" donation from 2008, 2007, and so on. How can I get it to pull up only his last donation and still pull up those who have never donated?
Code:
SELECT DONATIONS.DONATION_AMT, DONATIONS.CHECK_DATE, DATA.ACCT, DATA.FIRST_NAME,
DATA.MID_NAM, DATA.LAST_NAME, DATA.CARE_OF, DATA.ADDR1, DATA.ADDR2, DATA.CITY,
DATA.ST, DATA.ZIP, DATA.CODEB, DATA.EXP_YEAR
FROM DATA LEFT JOIN DONATIONS ON DATA.KEY = DONATIONS.KEY
WHERE (((DATA.ACCT)>99) AND ((DATA.EXP_YEAR)>"2007"));
FYI This query also filters out those with ACCT below 99 and EXP_YEAR above 2007 - so I am only sending to current members. This aspect is working well.