INNER JOIN ds04.envelope env ON env.fk_campaignname = campaignname.pklkey
INNER JOIN ds04.pledge plg ON env.envelopekey = plg.fk_envelope
WHERE plg.fk_contact = contact.contactkey
) AS reccount
FROM ds04.contact
WHERE contact.contactkey = 23460
GROUP BY contact.accountname, contact.contactkey
ORDER BY contact.accountname
This works fine except I’d like to change it so that the “Count()” only returns the count of unique keys. So if this account has more than one record for a given env.fk_campaignname I only want it to count as one occurance.