DECLARE @userId INT = ##userId##; WITH AllVotes AS ( SEL...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @userId INT = ##userId##;

WITH AllVotes AS (
  SELECT v.PostId AS [Post Link], vt.Name, v.CreationDate
  FROM Votes v
  INNER JOIN VoteTypes vt ON vt.Id = v.VoteTypeId
  WHERE v.UserId = @userId

  UNION

  SELECT pf.PostId AS [Post Link], vt.Name, pf.CreationDate
  FROM PostFeedback pf
  INNER JOIN VoteTypes vt ON vt.Id = pf.VoteTypeId
  WHERE pf.Id = @userId

)
SELECT * FROM AllVotes v
ORDER BY v.CreationDate DESC

Enter Parameters

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