Posts with tags not in favorites

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 @TagName nvarchar(600)
DECLARE @UserId int

SELECT @TagName = ##TagName:string##
SELECT @UserId = ##UserId##

SELECT DISTINCT TOP 100
  Posts.id as [Post Link],
  Posts.CreationDate
FROM Posts
WHERE 
  Posts.PostTypeId  = 1
  AND Posts.tags LIKE '%' + @TagName +'%' 
  AND Posts.Id NOT IN (
    SELECT PostId 
    FROM Votes 
    WHERE Votes.UserId=@UserId AND Votes.VoteTypeId = 5
  )
ORDER BY Posts.CreationDate DESC

Enter Parameters

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