Using Query to generate Mailing and Email Address List
I have been going in circles trying to figure out how to successfully write a query that essentially provides a mailing and email address list for each contact within a BP. I have found some other discussions with similar questions, but they have not resolved my questions.
Thank you in advance.
Here is where I currently stand:
FROM OCRD T0
INNER JOIN OCPR T2 ON T0.CardCode = T2.CardCode
INNER JOIN CRD1 T3 ON T3.Address = T2.Address
[dbo].[OCRG] T1, [dbo].[OCRD] T0
OCPR.[Address] could be either a Bill-To or Ship-To address since CRD1.[Address] is sometimes the same. So a where statement should probably be used such as WHERE T1.AdresType = 'S'. However, if for some reason, there is no associated address (OCPR.[Address] is blank) the contact should appear anyway
One additional piece of information I would like to include is any associated OCQG.[GroupName] and if there are multiples, they should each have their own column if possible.