N most recent answers tagged X from user Y containing text like Z

0

Please login or register to vote for this query.

(click on this box to dismiss)

Show the N most recent answers tagged X from user Y containing text like Z. See also http://data.stackexchange.com/stackoverflow/qe/1070 [Note: The site's own search facility can do most of this, and probably better; details: http://stackoverflow.com/search]

Stack Overflow

Q&A for professional and enthusiast programmers

-- N most recent answers tagged X from user Y containing text like Z
-- Show the N most recent answers tagged X from user Y containing text like Z. See also http://data.stackexchange.com/stackoverflow/qe/1070

declare @tagid int,
        @liketext varchar

SET nocount on

SELECT @tagid = Id FROM Tags WHERE TagName = ##JustOneTag:string##

SELECT TOP ##Limit##
    p.Id as [Post Link],
    p.CreationDate as [Answer Date]
FROM
    Posts p
INNER JOIN
    PostTags pt ON p.ParentId = pt.PostId AND pt.TagId = @tagid
WHERE
    p.PostTypeId = 2 -- 2 = Answer
    AND p.OwnerUserId = ##UserId##
    AND (p.Title LIKE ##TextUsingLikeSyntax:string##
         OR
         p.Body LIKE ##TextUsingLikeSyntax:string##)
ORDER BY
    p.CreationDate DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results