Questions with different titles than their revision history suggests

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

Вопросы и ответы для программистов

DECLARE @charactersToTrim NVARCHAR(8) = '.,!? ' + CHAR(9) + CHAR(10) + CHAR(13);

SELECT p.Id AS [Post Link], p.CreationDate, ph.Text
  FROM Posts AS p
  CROSS APPLY (
    SELECT TOP 1 Text
      FROM PostHistory
      WHERE PostId = p.Id
        AND PostHistoryTypeId IN (1, 4, 7) -- Title
      ORDER BY Id DESC
  ) ph
  WHERE p.PostTypeId = 1 -- Questions
    AND REPLACE(TRIM(@charactersToTrim FROM p.Title), ' ', '')
     != REPLACE(TRIM(@charactersToTrim FROM ph.Text), ' ', '')
  ORDER BY p.CreationDate DESC

Enter Parameters

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