Q&A for professionals, academics, and students working within the systems development life cycle
select P.id as [Post Link] from Posts P where p.PostTypeId = 1 and exists ( select 1 from posthistory ph where ph.postid = p.id and ph.PostHistoryTypeId = 14 -- locked ) and not exists ( select 1 from posthistory ph where ph.postid = p.id and ph.PostHistoryTypeId in (17, 12) -- migrated, deleted )