I would like to get the list of questioners who asked the most questions per tag. Can you please advise me how to write such a query? I do not care about the reputation of questioners, I care about the quantity of questions they ask.
-
2Do you know that going through the "top users" of every tag also shows that? See for discussion -> meta.stackexchange.com/tags/discussion/topusers (it shows answerers first and then askers)– fedorqui 'SO stop harming'Commented Dec 17, 2019 at 12:18
-
I do not know how to use your comment. I know that I can check how many questions single individual has asked. But I want a list of those who have asked the highest number of questions regardless their reputation. Top users may concern top rank, or am I mistaken?– Przemyslaw ReminCommented Dec 17, 2019 at 12:23
-
Well, my link may serve you... partially, since the 'top users' of a tag shows the list of users taking into account the score of their posts on that specific tag. So it does list based on the amount of questions or answers, but on the score they got posting.– fedorqui 'SO stop harming'Commented Dec 17, 2019 at 12:26
1 Answer
Here is a SEDE query: Users with most questions in a given tag.
SELECT TOP(##num?100##)
q.OwnerUserId AS [User Link], q.OwnerDisplayName,
COUNT (q.Id) AS [Question Count],
SUM (q.Score) AS [Total Score]
FROM Posts q INNER JOIN PostTags pt ON q.Id=pt.PostId
INNER JOIN Tags t ON t.id = pt.TagId
WHERE t.TagName=##tagName:string?data-explorer##
GROUP BY q.OwnerUserId, q.OwnerDisplayName
ORDER BY COUNT (q.Id) DESC
EDIT: I have changed the query following rene's suggestion in the SEDE chatroom. He pointed out that I made an unnecessary join with Users table in the query. And also that using the PostTags table is better then my original version, where I checked Tags LIKE '%<##tagName##>
. (Some further minor points: Addition of OwnerDisplayName ensures that the users who have deleted their accounts aren't added all together as one user. I have also omitted PostTypeId=1
which is now unnecessary - only questions have tags.)
You can also restrict the same query to the questions which are not community wiki. (See also: How to select community wiki questions?)
As already mentioned in the comments, even without using SEDE the top askers and answerers in a given tag (ordered by total score) are listed on the site. For each tag you have link to "Top Users", here is such link for the (data-explorer) tag.
It's slightly more complicated to get number (or score) for answerers, since you need look at the answer for the owner and at the question for the tag. Here are the queries for all answers and non-CW answers.
-
1A couple of more answers to beat Tim Stone. Getting that score might be the hardest part.– rene ModCommented Dec 17, 2019 at 12:57
-