1

I need to run a query to de-duplicate a DE based on the field Email. Email, however, is not the unique field. Two others that are unique are messing with my query.

I tried DISTINCT:

SELECT DISTINCT Email
FROM MyDataExt

But that brings up an error because I don't have the two unique fields (col1 and col2).

I can't select in the FROM because MC doesn't recognize the parentheses:

SELECT *
FROM (SELECT DISTINCT Email FROM MyDataExt)

So, would anyone know how can I run this query to de-dup based on Email address? Note: I looked into data filters, but I don't see how that allows me to de-dup because it's requiring me to have the email contain/equal to something ect, which isn't what I'n going for.

0

Assuming you have a date column (or any other column you can use to group the email addresses) :

SELECT Email 

FROM

(SELECT
 Email
 ,ROW_NUMBER()OVER(PARTITION BY email ORDER BY Date DESC) AS rank

 FROM MyDataExt) x

WHERE x.rank = 1
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.