Q&A for programmers
-- Percentage of questions with accepted answers, based on tags.
with totals as(
select top 200
t.TagName as 'Tag',
count(*) as 'TotalQuestion',
count(p.AcceptedAnswerId) as 'TotalAccepted'
from Posts p
join PostTags pt on pt.PostId = p.id
join Tags t on pt.TagId = t.id
group by t.id, t.TagName
order by TotalQuestion desc
select *, round(100 * TotalAccepted/TotalQuestion, 2) as 'Percentage' from totals
--where totals.TotalQuestion > 2000
order by Percentage desc
Error: looks like you typed in the wrong words - try again