De-duplicate rows in AMPScript

Sometimes using a Query Activity to de-duplicate data before an email send isn’t feasible. You can do it in AMPScript if you don’t mind sorting your external rows.

In this code block, you just need to use a variable to keep track of the previous value that you’ve displayed. When the current row doesn’t match the previous one, output it.

Reference

Leave a Reply

1 Comment on "De-duplicate rows in AMPScript"

Notify of
avatar
Sort by:   newest | oldest | most voted
Emilie
Guest

Hello there,

Thanks a lot for the code!
I’d like to use it but also to order my products with another column that the name, would that be possible?
I should then store all the previous displayed product name, how could I do that?

Thanks a lot,

wpDiscuz