Example for question How to get the serial number of the record after executing a query?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Enter Query Description

Anime and Manga

Q&A for anime and manga fans

-- Enter Query Title
-- Enter Query Description
DECLARE @userid int
set @userid = ##UserId##
;WITH CTE AS
    (
        SELECT OwnerUserId, RANK() OVER(ORDER BY Points DESC) Ranking
        FROM (  SELECT OwnerUserId, SUM(score) Points
                FROM posts
                GROUP BY OwnerUserId) A
    )
    SELECT *
    FROM CTE 
    WHERE OwnerUserId= @UserID

Enter Parameters

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