プログラマーと熱狂的なプログラマーのためのサイトに関する質問と回答
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 >= '2018-08-01' and p.CreationDate < '2019-08-01';