I know there are no Unknown Hero here in SOPT, but I know there are several not SOEN. My intention is to rank the percentage of votes accepted without the votes of the people holding this medal. And so I tried to create a SQL for Data Explorer . But I do not know SQL and I just tried to gather several examples and try to verify if I could.
The query I tried (I think it's the closest I've come):
SELECT TOP 100
Id as [User Link],
count(a.Id) as [Respostas Aceitas],
select
sum(CASE WHEN a.Score = 0 then 1 else 0 end)*1000 / count(a.Id) / 10.0 as [Porcentagem]
from
Users
inner join
Posts q
inner join
Posts a
on a.Id = q.AcceptedAnswerId and q.AcceptedAnswerId = Users.UserID
where
a.CommunityOwnedDate is null
and a.postTypeId = 2
order by Porcentagem
Error Message:
Incorrect syntax near the keyword 'select'. Incorrect syntax near the keyword 'where'.