User Comments by Year

1

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

DECLARE @UserId INT = '##UserId:INT##'

DECLARE @Year INT = '##Year:INT?0##'
SELECT @Year = IIF(@Year = 0, YEAR(CURRENT_TIMESTAMP), @Year)

SELECT
    ROW_NUMBER() OVER (ORDER BY c.CreationDate) AS #,
    c.Id,
    c.PostId,
    c.Score,
    c.Text,
    c.CreationDate

FROM
    Comments c

WHERE
    c.UserId = @UserId
    AND YEAR(c.CreationDate) = @Year    

ORDER BY
    c.CreationDate

Enter Parameters

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