Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding top-n

Status
Not open for further replies.

Rozza

Technical User
Jul 25, 2002
67
GB
Hi,

I need to write an sql query which will find the top n spenders in a table, based on the total the customers have spent which I have calculated already. Is there some form of "Clause" to enable me to do this? In JET SQL there is a command called top but it doesn't look ike this is available in interbase.

Best Regards

Paul Rowling
 
Hi,

In IB6.5 and up, you can use the ROWS clause. In IB < 6.5, you have to write a SELECTable stored procedure to return just a few rows. Or you can simply open your resultset (ORDERed right) and close it after fetching your &quot;n&quot; rows.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top