List of questions that are locked

1

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

;with lastlocked as 
(
  -- the last Id that was locked for a Post
  select max(id) id
       , postid
  from posthistory
  where posthistorytypeid = 14
  group by postid 
),
lastunlocked as 
(
  -- the last Id that was unlocked for a Post
  select max(id) id
       , postid
  from posthistory
  where posthistorytypeid = 15
  group by postid 
)



SELECT
  ph1.PostId AS [Post Link],
  'site://posts/' + CAST(ph1.PostId AS varchar)+'/revisions|revisions' AS [Revision History], 
  ph1.CreationDate
FROM PostHistory ph1 
INNER JOIN lastlocked ll on ll.PostId = ph1.PostId
INNER JOIN Posts q ON ph1.PostId=q.Id
LEFT OUTER JOIN lastunlocked lu 
    ON lu.Postid = ph1.PostId 
    AND lu.id > ll.id
WHERE (q.PostTypeId=1) 
AND (ph1.PostHistoryTypeId=14) 
AND lu.id is null
ORDER BY ph1.PostId DESC

Enter Parameters

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