SELECT u.Id, u.DisplayName, b.Name, p.Title AS LatestPost...

0

Please login or register to vote for this query.

(click on this box to dismiss)

English Language and Usage Meta

Q&A about the site for linguists, etymologists, and serious English language enthusiasts

SELECT u.Id, u.DisplayName, b.Name, p.Title AS LatestPostTitle
FROM Users u
JOIN Badges b ON u.Id = b.UserId
LEFT JOIN (
    SELECT Id, MAX(CreationDate) AS LatestPostDate
    FROM Posts
    GROUP BY Id
) AS latest_post ON u.Id = latest_post.Id
LEFT JOIN Posts p ON u.Id = p.Id AND latest_post.LatestPostDate = p.CreationDate
WHERE u.Location = 'Latvia' AND b.Name = 'Editor'
GROUP BY u.Id, u.DisplayName, b.Name, p.Title;

Enter Parameters

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