instruction: Total Questions, Answers, and Comments of 1000 most recently active users.
response: WITH RecentUsers AS (SELECT Posts.OwnerUserId, MAX(Posts.LastActivityDate) AS LastActivityDate, SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS Questions, SUM(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE 0 END) AS Answers FROM Posts WHERE Posts.OwnerUserId IN (SELECT Posts.Id FROM Posts ORDER BY Posts.LastActivityDate DESC LIMIT 1000) GROUP BY Posts.OwnerUserId), CommentCounts AS (SELECT Comments.UserId, COUNT(*) AS Comments FROM Comments GROUP BY Comments.UserId) SELECT OwnerUserId AS "user_link", Questions, Answers FROM RecentUsers ORDER BY RecentUsers.LastActivityDate DESC