Search my 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 @PostText nvarchar(600) = ##PostText:string##
DECLARE @UserId INT

SELECT @PostText = UPPER(@PostText)
SELECT @UserId = ##UserId##
SELECT
    Posts.Id AS [Post Link],
    Posts.Score AS [Score],
    Posts.CreationDate AS [Creation Date]
FROM
    Posts
LEFT JOIN Votes ON Posts.ID = Votes.PostId
WHERE
    Posts.PostTypeId = 1 AND
    Votes.VoteTypeId = 5 AND
    Votes.UserId = @UserId AND (
    UPPER(Posts.Body) LIKE '%' + @PostText + '%' OR
    UPPER(Posts.Title) LIKE '%' + @PostText + '%')
ORDER BY
    Posts.CreationDate
DESC

Enter Parameters

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