Paging through large data sets


Please login or register to vote for this query.

(click on this box to dismiss)

Refer to

Stack Overflow

Q&A for professional and enthusiast programmers

-- StartRow: Starting row for paging
-- EndRow: Ending row for paging (Max 50K rows at a time)
-- Note: Magic column names bust query on Stack Overflow data set!
WITH allData AS (
                ROW_NUMBER() OVER (ORDER BY P.creationdate) AS row
                , P.creationdate
                , P.tags
                , P.owneruserid
                , P.answercount
    FROM        Posttags    AS PT
    JOIN        Posts       AS P    ON PT.postid =
    WHERE       PT.tagid    = 3143  --  tag [scala]
SELECT      *
FROM        allData
WHERE       row    >= ##StartRow:INT?1##
AND         row    <= ##EndRow:INT?50000##
ORDER BY    row

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results