How to sum count value in SQL Server ?
I have table 1. I want to sum count value.
How to do that ?
SELECT Top 10 count(d.name) as countname,d.name as name ,sum(count(d.name)) as sumcount
FROM table 1 as d
group by d.name order by count(d.name) desc
I want to display countname, name, sumcount. How to do that ?
SELECT TOP 10 COUNT(*) AS countname, d.name FROM table 1 as d GROUP BY d.name ORDER BY COUNT(*) DESCwill give you the top 10 most usedd.namevalues as well as the number of times they're used.