You better show me some fucking gratitude after I did your homework for free

0

Please login or register to vote for this query.

(click on this box to dismiss)

Wholesome comments to me (no mean comments)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

declare @userID int = ##UserID?9449426##
declare @userName nvarchar(max)

-- Find and get the user name based on user ID
SELECT TOP 1 @userName = DisplayName
FROM Users
WHERE Id = @userId

-- Find all answers from this user
SELECT *
INTO #myPosts
FROM Posts
WHERE OwnerUserId = @userID
  AND PostTypeId = 2
  AND CommentCount > 0
  AND DeletionDate IS NULL


-- Find all comments of this user posts. Filter by
-- comment text takes too long otherwise
SELECT c.Text AS Comment,
       c.UserId AS [User Link],
       p.Id AS [Post Link]
FROM Comments c
JOIN #myPosts p ON p.Id = c.PostId
WHERE Text LIKE ('%' + @userName + '%')
  --AND Text LIKE '%thanks%'

Enter Parameters

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