Created
January 15, 2016 03:24
-
-
Save nwwells/55423f9c6c844da205de to your computer and use it in GitHub Desktop.
Purpose Portfolio Giving Reports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
client.name AS "Company", | |
ppuser."createdAt" AS "Account Sign-up Timestamp", | |
"firstName" AS "First Name", | |
"lastName" AS "Last Name", | |
"workEmail" AS "Email", | |
"confirmedAt" AS "Account Confirmation Timestamp", | |
SUM(engagement.amount) AS "Paycheck Donation Amt / Charity", | |
portfoliounit.name AS "Charity" | |
FROM client | |
INNER JOIN ppuser | |
ON ppuser.owner = client.id | |
INNER JOIN engagement | |
ON ppuser.id = engagement.owner | |
INNER JOIN opportunity | |
ON engagement.master = opportunity.id | |
INNER JOIN portfoliounit | |
ON opportunity.owner = portfoliounit.id | |
WHERE | |
engagement.amount > 0 | |
AND | |
client.name = 'Experticity' | |
AND | |
"deactivatedAt" IS NULL | |
GROUP BY | |
client.name, | |
portfoliounit.id, | |
ppuser.id | |
ORDER BY | |
client.name, | |
ppuser."createdAt" ASC, | |
"workEmail" ASC, | |
portfoliounit.name ASC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
client.name AS "Company", | |
ppuser."createdAt" AS "Account Sign-up Timestamp", | |
"firstName" AS "First Name", | |
"lastName" AS "Last Name", | |
"workEmail" AS "Email", | |
"confirmedAt" AS "Account Confirmation Timestamp", | |
"payrollDeduction" AS "Total Paycheck Donation Amt" | |
FROM ppuser | |
INNER JOIN client | |
ON ppuser.owner = client.id | |
WHERE | |
client.name = 'Experticity' | |
AND | |
"deactivatedAt" IS NULL | |
ORDER BY | |
client.name, | |
ppuser."createdAt" ASC, | |
"workEmail" ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment