SELECT TOP (50000) q.Id,u.DisplayName AS "Asker", u.Id A...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sustainable Living

Q&A for folks dedicated to a lifestyle that can be maintained indefinitely without depleting available resources

SELECT TOP (50000)

 q.Id,u.DisplayName AS "Asker",
    u.Id AS AskerLink,
    au.DisplayName AS "Answerer",
     au.Id AS AnswererLink,
    null as Link,
    q.Body as QuestionBody,
    q.Title,
    a.Body AS HighestScoringAnswer

       from posts a 
       inner join (select r.Id, r.Title,r.Body,r.OwnerUserId, max(p.Score) Score
               from posts p 
               inner join posts r
               on p.ParentId = r.Id where p.PostTypeId = 2 
               and p.Score >= 0
               group by r.Id, r.Body,r.Title,r.OwnerUserId) q
       on a.ParentId = q.Id
       and a.Score = q.Score
       join Users u ON q.OwnerUserId = u.Id
       JOIN Users au ON a.OwnerUserId = au.Id
      
       
WHERE q.id >##qid##
ORDER BY q.id

Enter Parameters

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