0373 Закарьяев КР Задание-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
amounts(TagId, Month, Year, Amount)
as
(
select
t.TagId as TagId,
month(p.CreationDate) as Month,
year(p.CreationDate) as Year,
count(*) as Amount
from
Posts p
inner join PostTags t on p.Id = t.PostId
group by t.TagId, month(p.CreationDate), year(p.CreationDate)
)

SELECT TOP 1 WITH TIES TagId, Month, Year, Amount FROM amounts
ORDER BY RANK() OVER(PARTITION BY TagId ORDER BY Amount DESC, Year DESC, Month DESC)

Enter Parameters

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