Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL - Select top 20 records

SQL - Select top 20 records

From: Phil Dodderidge <pdodde_at_f-m-h.com>
Date: Fri, 12 Mar 1999 10:10:28 -0600
Message-ID: <36E93C74.F4279FFB@f-m-h.com>


I am converting a Foxpro report to Oracle and I need to figure out how to do the following:

In Foxpro:  

Select Top 20 membno, sum(paid_amt) as paidamt   group by membno
  order by paidamt desc

Returns an ordered list of the 20 members who had the largest paid claims amount.

How do I do this in Oracle?

I have tried using ROWNUM but this doesn't work and I can't use ORDER BY in subqueries.

I have 20-30K members and can't return them all.

Thanks for any help,

Phil Received on Fri Mar 12 1999 - 10:10:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US