select p.Title, p.Body, p.Id, p.CreationDate, p4.Title, p...

0

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

select p.Title, p.Body, p.Id, p.CreationDate,
  --JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]') as DuplicateId,
  p4.Title, p4.Body, p4.Id, p4.CreationDate
from posts p
inner join PostHistory ph on ph.postid = p.id
inner join posts p4 on p4.id = JSON_VALUE(ph.Text, '$.OriginalQuestionIds[0]')
where p.posttypeid = 1  -- 1
and ph.PostHistoryTypeId = 10  -- closed
and ph.comment = 101  -- as duplicate
and p.CreationDate >= '2015-08-01'
and p.CreationDate < '2017-08-01';

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results