So do you have your answer on dba.SE?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT TOP 100
       row_number() OVER (ORDER BY c.CreationDate DESC) AS [Nr]
     , p.Id AS [Post Link]
     , c.Text
     , c.CreationDate AS c_date
     , c.Score AS c_score
     , 'site://questions/' + CAST(p.Id AS nvarchar) + '#' + CAST(p.AcceptedAnswerId AS nvarchar) AS [Accepted Answer]
     , (SELECT count(*)
        FROM   Comments AS c1
        WHERE  c1.PostId = c.PostId
        AND    c1.CreationDate > c.CreationDate) AS later_comments
FROM   Comments AS c
JOIN   Posts As p ON p.Id = c.PostId
WHERE  c.Text LIKE '%' + ##SearchQuery:string?o you have%answer## + '%'
AND    c.UserId = ##UserId:int?3684##  -- My dba.SE userID as default
ORDER  BY c.CreationDate DESC;

Enter Parameters

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