Get 10 most recent questions where title is same as body

0

Please login or register to vote for this query.

(click on this box to dismiss)

Web Applications

Q&A for power users of web applications

SELECT TOP 10 p.Id AS [Post Link], p.Body, p.CreationDate
FROM (
  SELECT * FROM Posts
  WHERE PostTypeId = 1
    AND LEN(Body) < LEN(Title) + 30
    AND LEN(Body) > LEN(Title)
) p
INNER JOIN (
  SELECT ph1.* FROM PostHistory ph1
  INNER JOIN (
    SELECT PostId, MAX(CreationDate) AS CreationDate
    FROM PostHistory
    WHERE PostHistoryTypeId IN (2,5,8)
    GROUP BY PostId
  ) ph2
  ON ph1.PostId = ph2.PostId AND ph1.CreationDate = ph2.CreationDate
  WHERE PostHistoryTypeId IN (2,5,8)
) ph
ON p.Id = ph.PostId
WHERE LOWER(p.Title) = LOWER(ph.Text)
ORDER BY CreationDate DESC

Enter Parameters

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