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:
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:
SELECT COUNT(*) as UniqueCodeCount, UniqueCode FROM DataExtension GROUP BY UniqueCode
orSELECT COUNT(UniqueCode) as UniqueCodeCount, UniqueCode FROM DataExtension GROUP BY UniqueCode
or however you want those column to be named (called it UniqueCodeCount)