Customer Support Language
 
HomeKnowledge BaseCampaignMaxCampaignMax Query to show payments distributed by appeal
Information
Article ID108
Created On2/10/2005
Modified6/6/2005
Share With Others
CampaignMax Query to show payments distributed by appeal
This query shows the amount distributed to each appeal within a given PaymentDate. Remember, the PaymentDate is editable by the user.

SELECT
ap.AppealDesc,
SUM(di.DistributionAmount) AS TotalDistributed
FROM
camDistributions di,
camPayments py,
camPledges pl,
camAppeals ap
WHERE
/* JOIN - to get payment at the payment date */
di.PaymentID = py.PaymentID
/* JOIN - to get to the pledge distributed to */
AND di.PledgeID = pl.PledgeID
/* JOIN - to get the appeal desc */
AND pl.AppealID = ap.AppealID
/* FILTER - to limit to given dates */
AND py.PaymentDate >= '01-JAN-2004'
AND py.PaymentDate <= '31-MAR-2004'
GROUP BY
ap.AppealDesc