Q&A for professional and enthusiast programmers
-- OK, let's find the most duplicated posts on stackoverflow!
select pl.relatedpostid as [Post Link], p.tags,
from postlinks pl
join posts p
on pl.relatedpostid = p.id
where pl.linktypeid = 3
and pl.creationdate > '01-JAN-2020'
group by pl.relatedpostid, p.tags
having count(distinct pl.postid) > 3
order by count(distinct pl.postid) desc
select * from closereasontypes
-- 1 - exact duplicate
-- 101 - duplicate
--select * from posts where id = 510348
-- just closed date
--select * from postswithdeleted where id = 510348 -- thought maybe we'd get a parentid
--select * from postnoticetypes -- the post definitely has a notice... not seeing a duplicate notice type
--select * from comments where postid = 510348
-- comment has URL suggesting parent post, but this isn't the kind of concrete link I was hoping for.
-- select * from closeasofftopicreasontypes -- no links to questions, just actioning moderators
--select * from pendingflags where postid = 510348
--select * from postfeedback where postid = 510348
--select * from posthistory where postid = 510348 -- ok now we're getting somewhere!
--select * from posthistorytypes -- 10 = post closed, text field contains json with key OriginalQuestionIds to List[Int]
-- oh, that's way easier.
--select * from postlinks where postid = 510348
-- I'm going to guess linktypeid =1 is proposed duplicate, and linktypeid =3 is closed and pointing to this duplicate.