Customer Support Language
 
HomeKnowledge BaseCampaignMaxCampaignMax Query to get payments over $250 in a year for all people and corp gifts
Information
Article ID153
Created On1/16/2007
Modified1/16/2007
Share With Others
CampaignMax Query to get payments over $250 in a year for all people and corp gifts
This query will get all payments that match this criteria:
1) Payments were at least $250
2) Payments happened in 2006
3) Payments were made by a Person OR
Payments were made by a Company AND applied to a Corp Pledge

SELECT
n.DisplayName,
n.AddressLine1,
n.AddressLine2,
n.City,
n.State,
n.Zip,
p.PaymentDate,
p.PaymentDesc,
p.PaymentAmount
FROM
camPayments p,
camNamesV n
WHERE
/* JOIN - to get the Name Info */
p.NameID = n.NameID
/* FILTER - limit to People Payors OR Payments that were applied to corporate gifts */
AND
(n.NameType = 'P'
OR
p.PaymentID IN
(SELECT
di.PaymentID
FROM
camDistributions di,
camPledges pl
WHERE
/* JOIN - to get to the pledge distributed to */
di.PledgeID = pl.PledgeID
/* FILTER - to get corporate pledges only */
AND pl.PledgeTypeID = (SELECT PledgeTypeID FROM camPledgeTypes WHERE PledgeCategory = 'C') ) )
/* FILTER - limit to payments over $250 */
AND p.PaymentAmount >= 250
/* FILTER - to limit to given dates */
AND p.PaymentDate >= '01-JAN-2006'
AND p.PaymentDate <= '31-DEC-2006'