7
I know there’s no Unknown Hero here at SOPT, but I know there are several at SOEN. My intention is to sort the percentage of responses accepted without votes of the people who hold this medal. And so I tried to create an SQL for the Data Explorer. But I don’t know SQL and I just tried to put together several examples and try to see if I could.
The query I tried (I think it’s the closest I got):
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'.
What is the result of the query? You can put a link to your test in the DE?
– brasofilo
@Brasofilo, I have no way to put the link, because I could not log there with facebook and also think that it does not save a
query
mistakenly.– DeMarco
I’ve adjusted the syntax of your query, but there’s a Join I don’t understand. p.:
(q.AcceptedAnswerId = Users.UserID)
. Here is the link: http://data.stackexchange.com/stackoverflow/query/edit/218881. Some things are still missing.– Wakim
Do you simply want who has the medal? If it is, it has a table
Badges
, just look at her.– bfavaretto
Friend, which database?
– SneepS NinjA
@bfavaretto explained better in that comment
– DeMarco
Okay, I edited the question by adding that information. Always prefer to edit the question to add information in comments, because nothing guarantees that an obsessive-compulsive moderator arrives and clears all comments of the question (don’t look at me...) :)
– bfavaretto