I'm trying to pull in a list of contacts who've ordered within the last 2 days into a separate DE with the contact ID as the Primary Key. However, I've tried several SQL Join queries in Marketing Cloud, and continue to run into the following error:
Violation of Primary Key Constraint
Here's my query:
SELECT
c.Id,
c.Email,
c.FirstName,
c.LastName,
o.Id as OrderID,
o.Total_Charges__c,
o.Order_Date__c,
o.Order_Store__c,
FROM Order__c_Salesforce as o
INNER JOIN Contact_Salesforce as c
on o.Customer_Contact__c = c.Id
WHERE
DATEDIFF(day,o.Order_Date__c, GetDate()) <= 2
AND
c.email is not null
Any thoughts on how I select one of the many orders a potential customer may have to prevent this issue?