Duplicates of questions I answered

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

-- Search closed questions closed as duplicate of questions 
-- where answers of UserId were accepted or useful.

select 

  -- question infos
  q.CreationDate                         [Q CreationDate],
  'site://q/' + CAST(q.Id AS nvarchar)   [Q Link], 
  q.Title                                [Q Title],
  q.ViewCount                            [Q ViewCount],
  q.Score                                [Q Score],
  
  -- answer infos
  a.Score                                [A Score],

  -- duplicate infos
  dup.CreationDate                       [Dup CreationDate],
  'site://q/' + CAST(dup.Id AS nvarchar) [Dup Link],
  dup.Title                              [Dup Title],
  dup.ClosedDate                         [Dup ClosedDate],
  dup.ViewCount                          [Dup ViewCount],
  dup.Score                              [Dup Score]

from Posts a

  inner join 
    Posts q on q.Id = a.ParentId -- question of answers
  
  inner join 
    PostLinks pl on pl.LinkTypeId = 3 and pl.RelatedPostId = q.Id -- marked as duplicate of the question
  
  inner join 
    Posts dup on dup.Id = pl.PostId -- link to dup question
    
where
      a.OwnerUserId = ##UserId##                 -- are my answers
  and a.DeletionDate is null                     -- are not deleted
  and (q.AcceptedAnswerId = a.Id or a.Score > 0) -- are accepted or helpful
  and q.closedDate is null                       -- unclosed questions
  
order by 
  a.Id desc

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results