I have created an autoamtion that pulls the data from Data View and saved the records in a data extension (My_Sub_DE) using the following sql query.
SELECT * FROM ent._Subscribers WITH (NOLOCK)
Now, that I have all records in the data extension (My_Sub_DE), I am using the following SQL query to pull top 10 domain names and saving it in another data extension (My_Sub_DE_DomainsStats)
select top 10 Domain, count(*) AS Count from My_Sub_DE group by Domain order by Count desc
My data extension - My_Sub_DE_DomainsStats, includes these 3 columns - Domain - Count - Percent
Currently, I am getting the top 10 domains with count based on my above (2nd) sql query but I want to calculate the percentage also.
Can anyone please help with the SQL query?
This is what I have created so far but I am getting error - Incorrect syntax near the keyword 'Percent'.
select top 10 Domain, count(*) AS Count, (count(*)*100 / (SELECT COUNT(*) FROM ent._Subscribers WITH (NOLOCK))) AS Percent from My_Sub_DE group by Domain order by Count desc