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.


Leave a Reply

1 Comment on "De-duplicate rows in AMPScript"

newest oldest most voted
Notify of

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,