matttcooke
9/13/2017 - 1:27 PM

SQL calculate percentage of value instances in a table

select Extension, CAST(count(Extension) * 100.0 / sum(count(*)) over() AS DECIMAL(18, 2)) AS [Percentage]
from MslSiteDocuments
group by Extension
order by extension