Accepted Answer Score on All Q's

0

Please login or register to vote for this query.

(click on this box to dismiss)

Russian Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language

SELECT 
  p1.Id, 
  CONCAT('https://gaming.stackexchange.com/questions/', p1.Id, '|', p1.Title) AS [Post],
  acc.Score as AcceptedScore, 
  MAX(ans.Score) as HighestScore,
  CASE WHEN acc.Score >= MAX(ans.Score) THEN 1 ELSE 0 END AS [AcceptedIsHighest]
FROM POSTS p1 
  INNER JOIN POSTS acc on acc.Id = p1.AcceptedAnswerId
  INNER JOIN POSTS ans on ans.ParentId = p1.Id and ans.PostTypeId = 2 and ans.Id != acc.Id
WHERE p1.PostTypeId = 1
GROUP BY p1.Id, p1.Title, acc.Score
ORDER BY p1.id;

Enter Parameters

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