1

I have duplicate emails in "Contacts" table. I want to retrieve all the records from Contacts table where email matches in table "CELL 157". And not Duplicate emails.

I tried using Group BY but I am getting error, I tried using DISTINCT function it's also retrieving duplicate emails.

SELECT * FROM CONTACTS
WHERE 
RecordType = 'QUOTE'
AND
CAN_CONTACT = 'Y'
AND
EMAIL IN
(SELECT EMAIL FROM [CELL 157])
2
  • In case of duplicate emails, which matching contact you will choose? First matching or any arbitrary matching? Oct 15, 2016 at 2:13
  • @SantanuBoral Any arbitrary
    – Sohail
    Oct 17, 2016 at 13:07

1 Answer 1

0

Your contacts table may be pretty big, and the DISTINCT parameter will only remove duplicates if all columns contain the exact data, since you're retrieving all columns using SELECT *.

This presents other problems that you can either solve within your query or in your AMPSCRIPT in the message itself, namely: what if the contact record has been updated and you take the first but not most recent record?

If you aren't using the data in the contacts table in your message then there's no reason to build a data extension with it. This will make your data extension simpler and will allow you to make your query more specific to eliminate duplicates.

Another way to eliminate duplicates of course it so specify the removal of duplicates in your user-initiated send profile.

Let me know if that helps or if you have any other questions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .