SELECT Tags.TagName as Region, COUNT(DISTINCT Posts.Id) a...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ebooks

Q&A for ebook publishers and readers

SELECT 
    Tags.TagName as Region,
    COUNT(DISTINCT Posts.Id) as QuestionCount,
    AVG(Posts.Score) as AvgScore,
    SUM(Posts.ViewCount) as TotalViews,
    COUNT(DISTINCT Answers.Id) as AnswerCount
FROM Posts
LEFT JOIN PostTags ON Posts.Id = PostTags.PostId
LEFT JOIN Tags ON PostTags.TagId = Tags.Id
LEFT JOIN Posts Answers ON Posts.Id = Answers.ParentId
WHERE Tags.TagName IN ('india', 'usa', 'europe', 'asia', 'australia')
    AND Posts.PostTypeId = 1
GROUP BY Tags.TagName
ORDER BY QuestionCount DESC;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results