/*SELECT users.Id, posts.OwnerUserId, posts.id, posts.Acc...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

/*SELECT users.Id, posts.OwnerUserId, posts.id, posts.AcceptedAnswerId, posts.PostTypeId 
FROM users 
INNER JOIN posts ON users.Id = posts.OwnerUserId
INNER JOIN posts a ON posts.AcceptedAnswerId = a.Id
WHERE users.CreationDate BETWEEN DATEADD(DAY, -30, GETDATE()) and GETDATE()
AND posts.AcceptedAnswerId is not null;*/ 
/*AND (posts.PostTypeId = 2 OR posts.PostTypeId = 1);*/

SELECT 
    users.Id,
    Count(DISTINCT a.Id) AS Answers
FROM posts
INNER JOIN users ON users.Id = posts.OwnerUserId
INNER JOIN posts a ON posts.AcceptedAnswerId = a.Id
INNER JOIN posts b ON ((a.OwnerUserId = b.OwnerUserId) AND (b.OwnerUserId = a.OwnerUserID))
WHERE users.CreationDate BETWEEN DATEADD(DAY, -30, GETDATE()) and GETDATE()
GROUP BY users.Id
Having Count(a.Id) >= 2;

/* sanity check */
/*Select Count(posts.Id) AS Answers from posts inner join users on users.id = posts.OwnerUserId 
where posts.PostTypeId = 2 And users.id = 10315025;*/
/* (POSTA.OWNERUSERID = ANSWERA.OWNERUSERID AND POSTB.OWNERUSERID = ANSWERB.OWNERUSERID)*/

Enter Parameters

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