Answers to Duplicate Questions by User

2

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

select
    [Post Link] = p.Id
  , [User Link] = a.OwnerUserId
  , a.Score
  , Answer    = case when p.AcceptedAnswerId = a.Id then 1 else 0 end
  , UpVotes   = count(case when v.VoteTypeId = 2 then 1 end)
  , DownVotes = count(case when v.VoteTypeId = 3 then 1 end)
from Posts p
  inner join Posts a
    on a.ParentId = p.Id
   and a.OwnerUserId = ##UserId##
  left join Votes v
    on v.PostId = a.Id
where exists (
  select 1
  from PostLinks pl
  where pl.PostId = p.Id
    and pl.LinkTypeId = 3
  )
group by p.Id, a.OwnerUserId, a.Score
  , case when p.AcceptedAnswerId = a.Id then 1 else 0 end
order by a.Score desc

Enter Parameters

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