Quantcast
Channel: How to select the nth row in a SQL database table? - Stack Overflow
Viewing all articles
Browse latest Browse all 35

Answer by monibius for How to select the nth row in a SQL database table?

$
0
0

SQL 2005 and above has this feature built-in. Use the ROW_NUMBER() function. It is excellent for web-pages with a << Prev and Next >> style browsing:

Syntax:

SELECT    *FROM    (        SELECT            ROW_NUMBER () OVER (ORDER BY MyColumnToOrderBy) AS RowNum,            *        FROM            Table_1    ) subWHERE    RowNum = 23

Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>