Q&A about the site for expert genealogists and people interested in genealogy or family history
SELECT Users.Id, Users.Location, COUNT(Badges.Id) AS Badge_Count FROM Badges, Posts, Users Where Users.Id = Badges.UserId and Users.Id = Posts.OwnerUserId and Users.Location like '%Latvia%' and Posts.CreationDate BETWEEN '2021-01-01' and '2021-12-01' GROUP BY Users.Id, Users.Location HAVING COUNT(DISTINCT YEAR(Posts.CreationDate)) > 0 ORDER BY Badge_Count DESC