SQL: Limit Rows Returned

29th Apr 2004

For plain SQL queries (i.e. SELECT col1, col2, col3 FROM table), it is possible to use the TOP keyword. By adding "TOP {n}" (where n is an integer value) right after SELECT, you can limit the number of rows you get to the first n rows.

SELECT TOP 20 last_name, first_name, emailFROM t_userORDER BY last_name, first_name

software