Skip to main content
2 of 2
added 141 characters in body
Daan Kramer
  • 153
  • 3
  • 14

Marketing Cloud COUNT and Group by specific value

I'm trying to create a SQL Query which counts the same values in a Data extensions and Groups them by a Unique Value.

Usecase: My data extension looks like this:

enter image description here

I want to see how many email addresses have used the same UniqueCode. Currently I have the following SQL running, but somehow he doesn't show me the count of a UniqueCode:

    SELECT COUNT(distinct email) as test1 , UniqueCode AS test2
  FROM DataExtension
  GROUP BY UniqueCode

The target Data Extension does contain the email and UniqueCode field, but I only receive the UniqueCodes or email.

Can someone help me?

Here is a screenshot on how I have it in mind:

enter image description here

Daan Kramer
  • 153
  • 3
  • 14