SELECT Q.Id AS QuestionId, Q.Title AS QuestionTitle, Q.Bo...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT 
    Q.Id AS QuestionId, 
    Q.Title AS QuestionTitle, 
    Q.Body AS QuestionBody,
    Q.OwnerUserId AS QuestionOwnerUserId,
    A1.Id AS Answer1Id, 
    A1.Body AS Answer1Body, 
    A1.OwnerUserId AS Answer1UserId,
    A2.Id AS Answer2Id, 
    A2.Body AS Answer2Body, 
    A2.OwnerUserId AS Answer2UserId
FROM 
    Posts Q
JOIN 
    Posts A1 ON Q.Id = A1.ParentId
JOIN 
    Posts A2 ON Q.Id = A2.ParentId
WHERE 
    Q.PostTypeId = 1 AND 
    A1.PostTypeId = 2 AND 
    A2.PostTypeId = 2 AND 
    A1.OwnerUserId != Q.OwnerUserId AND 
    A2.OwnerUserId != Q.OwnerUserId AND 
    A1.OwnerUserId != A2.OwnerUserId

Enter Parameters

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