S
Stephanie
Hi. I have a non-profit that receives donations (we hope!). Sometimes the
donation comes as "I'll give you $5,000 if you can match that $5,000 with
other donations between 05/01/06 and 07/01/06". Let's call this the matching
donation.
I have fields DateReceived, DollarAmtReceived, MatchBeginDate and
MatchEndDate. Difficulties I'm having: there really isn't a DateReceived for
the matching donation (unless we meet the match); the MatchBeginDate and
MatchEndDate are associated with the matching donation, not the other
donations. I'm not sure how to get the query I want, somthing that gives an
output:
John Doe matching donation $5,000; MatchBeginDate = 05/01/06; MatchEndDate =
07/01/06
Jane Smith DollarAmtReceived = $250, DateReceived = 05/05/06...
I appreciate suggestions for structuing the query. I've posted the query I
have so far below. Thanks!
SELECT Contacts.FirstName, Contacts.LastName,
ProjectPackage.DollarAmtReceived, ProjectPackage.DateReceived,
DonorType.DonorType, ProjectPackage.DonationTypeID,
ProjectPackage.MatchBeginDate, ProjectPackage.MatchEndDate
FROM (DonorType INNER JOIN Contacts ON DonorType.DonorTypeID =
Contacts.DonorTypeID) INNER JOIN (Status INNER JOIN ProjectPackage ON
Status.StatusType = ProjectPackage.StatusType) ON Contacts.ContactID =
ProjectPackage.ContactID
WHERE (((ProjectPackage.DateReceived)>=[MatchBeginDate] And
(ProjectPackage.DateReceived)<=[MatchEndDate]) AND
((ProjectPackage.DonationTypeID)="ca" Or (ProjectPackage.DonationTypeID)="cc"
Or (ProjectPackage.DonationTypeID)="ma"));
donation comes as "I'll give you $5,000 if you can match that $5,000 with
other donations between 05/01/06 and 07/01/06". Let's call this the matching
donation.
I have fields DateReceived, DollarAmtReceived, MatchBeginDate and
MatchEndDate. Difficulties I'm having: there really isn't a DateReceived for
the matching donation (unless we meet the match); the MatchBeginDate and
MatchEndDate are associated with the matching donation, not the other
donations. I'm not sure how to get the query I want, somthing that gives an
output:
John Doe matching donation $5,000; MatchBeginDate = 05/01/06; MatchEndDate =
07/01/06
Jane Smith DollarAmtReceived = $250, DateReceived = 05/05/06...
I appreciate suggestions for structuing the query. I've posted the query I
have so far below. Thanks!
SELECT Contacts.FirstName, Contacts.LastName,
ProjectPackage.DollarAmtReceived, ProjectPackage.DateReceived,
DonorType.DonorType, ProjectPackage.DonationTypeID,
ProjectPackage.MatchBeginDate, ProjectPackage.MatchEndDate
FROM (DonorType INNER JOIN Contacts ON DonorType.DonorTypeID =
Contacts.DonorTypeID) INNER JOIN (Status INNER JOIN ProjectPackage ON
Status.StatusType = ProjectPackage.StatusType) ON Contacts.ContactID =
ProjectPackage.ContactID
WHERE (((ProjectPackage.DateReceived)>=[MatchBeginDate] And
(ProjectPackage.DateReceived)<=[MatchEndDate]) AND
((ProjectPackage.DonationTypeID)="ca" Or (ProjectPackage.DonationTypeID)="cc"
Or (ProjectPackage.DonationTypeID)="ma"));