Posts with tags not in favorites


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 as [Post Link],
FROM Posts
  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

Switch sites:
loading Hold tight while we fetch your results