Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática
SELECT * FROM (SELECT YEAR(Posts.CreationDate) as CreationYear, --MONTH(Posts.CreationDate) as CreationMonth, TagName, COUNT(Posts.Id) as PostCount, RANK() OVER (PARTITION BY YEAR(Posts.CreationDate) ORDER BY COUNT(PostId) DESC) AS Rank --RANK() OVER (PARTITION BY YEAR(Posts.CreationDate) ORDER BY COUNT(PostId) DESC) AS Rank FROM Tags, PostTags, Posts, Users WHERE Tags.Id = PostTags.TagId and Posts.Id = PostId and Posts.OwnerUserId = Users.Id and (LOWER(Users.Location) like '%brazil' or LOWER(Users.Location) like '%brasil') --GROUP BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate), TagName) GROUP BY YEAR(Posts.CreationDate), TagName) AS TagPostRankings WHERE Rank <= 20 AND --CreationYear >= 2018 CreationYear = 2023 --ORDER BY CreationYear, CreationMonth, Rank ORDER BY CreationYear, Rank