Q&A about the site for people organizing, marketing or licensing open source development projects
SELECT TOP 10 Users.Id, Badges.Name, Users.Location, LastPost.LastPostId FROM Users LEFT JOIN Badges ON Badges.UserId = Users.Id LEFT JOIN ( SELECT OwnerUserId, MAX(Id) AS LastPostId FROM Posts WHERE PostTypeId = 1 GROUP BY OwnerUserId ) LastPost ON LastPost.OwnerUserId = Users.Id WHERE Users.Location LIKE '%Latvia%' AND Badges.Name = 'Editor';