Q&A for Drupal developers and administrators
SELECT p.Id AS PostId, p.CreationDate AS PostCreationDate, lh.CreationDate AS LockDate FROM Posts p JOIN PostHistory lh ON p.Id = lh.PostId WHERE lh.PostHistoryTypeId = 14 -- 14 is the PostHistoryTypeId for "Lock" AND lh.CreationDate < '2020-01-01' ORDER BY lh.CreationDate DESC