Q&A about the site for Drupal developers and administrators
SELECT * FROM PostHistory ph JOIN Posts p ON p.Id = ph.PostId JOIN Posts pd ON pd.Id = CAST(JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') AS nvarchar) WHERE p.PostTypeId = 1 -- Question AND ph.PostHistoryTypeId = 10 -- Close event AND ph.Comment = 101 -- Dupe