Q&A for professional and enthusiast programmers
--Show the top 50 ranked questions (post type) of users with badges only,
-- which were closed in September 2021.
select t.Id ,t.OwnerUserId,t.Score,t.Title,
order by t.Score desc
) as rank_id
select Id ,OwnerUserId, Score,Title
from Posts p
where PostTypeId = 1 and
ClosedDate >= '2021-09-01 00:00:00'
and ClosedDate < '2021-10-01 00:00:00' ) as t
(select distinct UserId
from Badges) as b
on t.OwnerUserId = b.UserId ) as t2
where t2.rank_id <= 50