Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save patpawlowski/2ee0d3e83b4f5f0a338d7a0cdb705029 to your computer and use it in GitHub Desktop.
Save patpawlowski/2ee0d3e83b4f5f0a338d7a0cdb705029 to your computer and use it in GitHub Desktop.
/*
Written by: Patrick Pawlowski
Company: Ticomix
Created On: 2016.06.10
Requires: https://gist.github.com/patpawlowski/eac1482fb346175c726fc41821cd9e1e#file-goldmine-contacts-view-sql
*/
Select ac.CONTACT, ea.CONTSUPREF + isnull(ea.ADDRESS1, '') EmailAddress
from CONTSUPP ac
left join CONTSUPP ea on ac.recid = ea.LINKACCT and ea.RECTYPE = 'P' and ea.CONTACT = 'E-mail Address'
where ac.RECTYPE = 'C'
union
Select CONTACT, EmailAddress from contacts
order by 1
@patpawlowski
Copy link
Author

A GoldMine query that uses the Contacts view to create a singe result set of primary contacts and additional contacts and their email address. Other fields can be added but remember to add them to both sides of the union. If you want to add fields that only exist for primary contacts then just add an empty string placeholder in the additional contacts part of the union.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment