Task 2

0

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

with temp as (
select count(l.PostId) as Posts_num, l.TagId as TagId, 
YEAR(r.CreationDate) as CreationYear, MONTH(r.CreationDate) as CreationMonth
from PostTags as l join PostHistory as r on l.PostId = r.PostId
Group by TagId, CreationDate
),
tt as (
select sum(Posts_num) as PostsCount, TagId, CreationYear, CreationMonth from temp
group by CreationYear, CreationMonth, TagId
)
SELECt TagName, CreationYear, CreationMonth  from
(select TagId, max(CreationYear) as CreationYear, CreationMonth, max(PostsCount) as MaxPostsCount from tt
group by TagId, tt.creationmonth ) AS er left join Tags on er.TagId=Tags.Id

Enter Parameters

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