Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

SELECT count(subtable1.PostId) AS Posts_num, subtable1.TagId AS TagId,
YEAR(subtable2.CreationDate) AS CreationYear, MONTH(subtable2.CreationDate) AS CreationMonth
FROM PostTags AS subtable1 JOIN PostHistory AS subtable2 ON subtable1.PostId = subtable2.PostId
GROUP BY TagId, CreationDate
t1 AS (
SELECT sum(Posts_num) AS PostsCount, TagId, CreationYear, CreationMonth FROM t
GROUP BY CreationYear, CreationMonth, TagId
SELECT TagName, CreationYear, CreationMonth  FROM
(SELECT TagId, MAX(CreationYear) AS CreationYear, MAX(CreationMonth) AS CreationMonth, MAX(PostsCount) AS MaxPostsCount FROM t1
GROUP BY TagId ) AS er LEFT JOIN Tags ON er.TagId=Tags.Id ORDER BY CreationYear, CreationMonth;

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results