Posts (answers/questions) of a deleted user with the number of upvotes and downvotes

1

Please login or register to vote for this query.

(click on this box to dismiss)

Quantitative Finance Meta

Q&A about the site for finance professionals and academics

SELECT
  p.Id AS [Post Link],
  p.CreationDate,
  SUM(Case When v.VoteTypeId = 2 Then 1 Else NULL End) AS UpVotes,
  SUM(Case When v.VoteTypeId = 3 Then 1 Else NULL End) AS DownVotes,
---2 = UpMod
---3 = DownMod
  p.Score,
  p.ViewCount,
  CASE 
    WHEN p.PostTypeid=1 THEN 'Question' 
    WHEN p.PostTypeId=2 THEN 'Answer'
  END,
  p.Tags
FROM Posts p LEFT OUTER JOIN Votes v ON v.PostId=p.Id
WHERE (p.OwnerDisplayName='user' + Convert(nvarchar(20), ##UserId##))
  AND (p.PostTypeId IN (##types?1,2##))
---1=answers
---2=questions
---1,2 both
GROUP By p.Id, p.CreationDate, p.Score, p.ViewCount, p.PostTypeid, p.Tags
ORDER BY p.CreationDate

Enter Parameters

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