Dup Questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

SELECT
  questions.Id AS QuestionId,
  questions.Title AS QuestionTitle,
  SUBSTRING(history.Text, CHARINDEX('[', history.Text), CHARINDEX(']', history.Text) - CHARINDEX('[', history.Text) + 1) AS Duplicate,
  questions.AcceptedAnswerId AS AcceptedAnswer,
  answers.Id AS MostVotedAnswer,
  answers.Score AS Votes,
  history.Text AS History
FROM Posts questions
INNER JOIN Posts answers ON answers.ParentId = questions.Id
INNER JOIN PostHistory history ON history.PostId = questions.Id
WHERE (
  questions.Id < 5000
) AND (
  history.PostHistoryTypeId = 10
) AND (
  answers.Id IN (
    SELECT TOP 1 p.Id
    FROM Posts p
    WHERE p.ParentId = questions.Id
    ORDER BY p.Score DESC
  )
)
ORDER BY answers.Score DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results