John Topley's Knowledgebase

SQL Statement To Return The Top n Rows

Sunday, 14 September 2003

This Oracle SQL statement will return the top n rows in a table named t, ordered by a column named c.

SELECT * FROM (SELECT * FROM t ORDER BY c) WHERE ROWNUM <= n

top | index | previous | next | comments ()

home | archive | kb | media | about | contact | accessibility
Copyright © 2003 - 2005 John Topley. Made with CityDesk.