SELECT t.TagName as RailTopic, COUNT(DISTINCT p.Id) as To...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Home Improvement

Q&A for contractors and serious DIYers

SELECT 
    t.TagName as RailTopic,
    COUNT(DISTINCT p.Id) as TotalPosts,
    SUM(p.ViewCount) as TotalViews,
    AVG(CAST(p.Score AS FLOAT)) as AvgScore
FROM Posts p
LEFT JOIN PostTags pt ON p.Id = pt.PostId
LEFT JOIN Tags t ON pt.TagId = t.Id
WHERE t.TagName IN ('trains', 'railways', 'europe', 'public-transport')
GROUP BY t.TagName
ORDER BY TotalViews DESC;

Enter Parameters

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