Questions where some past revision had tag1 but not tag2


Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

with firstrev_cte AS
SELECT MIN(ph.Id) AS MinId, p.Id 
FROM Posts p JOIN PostHistory ph ON ph.PostId=p.Id
WHERE (ph.Text LIKE '%<##tagName1##>%')
  AND NOT(ph.Text LIKE '%<##tagName2##>%')
  AND (ph.PostHistoryTypeId in (3,6,9))

SELECT PostId AS [Post Link],
  url = 'site://posts/' + CAST(PostId AS varchar)+'/revisions',
  UserId AS [User Link], UserDisplayName, CreationDate, Comment, Text AS [Tags]
FROM PostHistory INNER JOIN firstrev_cte ON PostHistory.Id=MinId
ORDER BY CreationDate DESC

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results