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)

Skeptics

Q&A for scientific skepticism

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
LEFT JOIN Users u ON p.OwnerUserId = u.Id
WHERE t.TagName IN ('trains', 'railways', 'europe', 'public-transport')
  AND u.Location LIKE '%USA%' -- アメリカのユーザーに限定
GROUP BY t.TagName
ORDER BY TotalViews DESC;

Enter Parameters

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