declare @userId int = ##userId##; select p.* from ( select

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

declare @userId int = ##userId##;

select
 p.*
from
(
  select
   p.Id
  ,p.Title
  ,vt.Name
  from Posts as p
    left join Votes as v
      join VoteTypes as vt
      on vt.Id = v.VoteTypeId
    on v.PostId = p.Id
    and v.VoteTypeId in (1,2,3)
  where p.OwnerUserId = @userId
  and p.PostTypeId = 2 -- answer  
) as q
pivot
(
  count(q.Name) for q.Name in
  (
     AcceptedByOriginator
    ,UpMod
    ,DownMod  
  )
) as p
order by 
 p.DownMod desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results