Favorites that you haven't posted in

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
  votes.PostId AS [Post Link],
  votes.CreationDate,
  COUNT(*) AS 'AnswerNo'
FROM Votes votes
JOIN Posts questions ON votes.PostId = questions.Id
JOIN Posts answers ON votes.PostId = answers.ParentId
WHERE votes.VoteTypeId = 5 --Favorite
  AND votes.UserId = ##UserId##
GROUP BY votes.PostId, votes.CreationDate
HAVING SUM(CASE WHEN 
    (answers.OwnerUserId = ##UserId## OR questions.OwnerUserId = ##UserId##) 
    THEN 1 ELSE 0 END) = 0
ORDER BY votes.CreationDate DESC

Enter Parameters

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