Uzdevums 1

0

Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

SELECT TOP 10
  Users.Id,
  COUNT(DISTINCT Badges.Id) AS Badge_Amount,
  MAX(Posts.CreationDate) AS Last_Post,
  Users.Location
FROM Users
LEFT JOIN Badges
  ON Badges.UserId = Users.Id
LEFT JOIN Posts 
  ON Posts.OwnerUserId = Users.Id
WHERE Users.Location LIKE '%Latvia%'
GROUP BY Users.Id, Users.Location
HAVING COUNT(Badges.Id) > 100
AND MAX(Posts.CreationDate) > '2021-01-01'
ORDER BY Badge_Amount DESC;

Enter Parameters

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