プログラマーと熱狂的なプログラマーのためのサイトに関する質問と回答
select count(distinct dp.id) from Posts dp join PostHistory ph on ph.PostId = dp.Id join PostLinks pl on dp.Id = pl.PostId join Posts op on op.Id = pl.RelatedPostId join PendingFlags pf on pf.PostId = dp.Id where dp.PostTypeId = 1 -- Question post -- and ph.PostHistoryTypeId = 10 -- 10=Post Closed and pf.CloseReasonTypeId = 1 -- Exact duplicate and pl.LinkTypeId = 3 -- duplicate and dp.Tags like '%<r>%'