Good reference links for the TOP Keyword

This past week I needed to use the TOP keyword for some code and came across some excellent resources:

First, the quick basics of top:

Dynamically controlling the number of rows affected by a SQL Server query

Next, a good article on how to retrieve top and bottom rows together:

How to Retrieve TOP and BOTTOM Rows Together using T-SQL

And an excellent article on the TOP per group scenario:

Who’s On First? Solving the Top per Group Problem

And the book Inside Microsoft SQL Server 2008 T-SQL Querying there is a whole chapter mostly on TOP; Chapter 9 TOP and APPLY.

TOP isn’t something used everyday in SQL Server, but when you need it, you’ll be happy it’s part of TSQL.

One Response to Good reference links for the TOP Keyword
  1. MarlonRibunal
    February 25, 2010 | 1:11 am

    Inside Microsoft SQL Server 2008 T-SQL Querying is an awesome sql book! I wish I have the time to read all the content ;-)