Emails
Queries to get an export of email addresses from the database for various communications.
Get Backers (name, email, totalDonations, lastDonation) of a collective
WITH constants AS (
SELECT id FROM "Collectives" WHERE slug='chsf'
), total_donations AS (
SELECT
max("FromCollectiveId") as "FromCollectiveId",
SUM(amount) as amount,
max("createdAt") as "lastDonationAt"
FROM "Transactions" t
WHERE t."CollectiveId" IN (SELECT id FROM constants) AND t.amount >= 0
GROUP BY "FromCollectiveId"
)
SELECT
m."MemberCollectiveId" as id,
m."createdAt" as "createdAt",
td."lastDonationAt" as "lastDonation",
u."firstName" as "firstName",
u."lastName" as "lastName",
u.email as email,
m.role as role,
c.website as website,
c."twitterHandle" as "twitterHandle",
td.amount as "totalDonations"
FROM "Members" m
LEFT JOIN "Collectives" c ON c.id = m."MemberCollectiveId"
LEFT JOIN "Users" u on u."CollectiveId" = c.id
LEFT JOIN total_donations td ON td."FromCollectiveId" = m."MemberCollectiveId"
WHERE m."CollectiveId" IN (SELECT id FROM constants)
AND m."deletedAt" IS NULL
ORDER BY "totalDonations" DESC, m."createdAt" ASCGet RSVPs to an event
Fetch all email addresses
Fetch email addresses of all admins of collectives on a given host
opt - in newsletter emails
All admins of organizations
(that have sponsored at least one "open source", "diversity in tech" or "Tech meetups" collective)
Last updated