Link to home
Start Free TrialLog in
Avatar of Stephen Daugherty
Stephen Daugherty

asked on

LIMIT ROWS RETURNED IN ACCESS QUERY

I am running a query that is returning some summary data from a table in Access. I have built the query with the intentions of it driving an Access report, but I want to limit the rows returned to the first 20 rows. I have tried WHERE ROWNUM < 21, but plugging it into the SQL of the Access query does not work. What can I use here to limit the number of rows returned? This is running in Access and not ASP. The SQL is included below:

SELECT TBL_D02_PROG_4_SUMMARY.CUST_ID, TBL_D02_PROG_4_SUMMARY.NAME1, Sum(TBL_D02_PROG_4_SUMMARY.QTY_ORDERED) AS TOT_ORDERED, Sum(TBL_D02_PROG_4_SUMMARY.ORDER_TOTAL_PRICE) AS SUM_PRICE
FROM TBL_D02_PROG_4_SUMMARY
GROUP BY TBL_D02_PROG_4_SUMMARY.CUST_ID, TBL_D02_PROG_4_SUMMARY.NAME1
ORDER BY Sum(TBL_D02_PROG_4_SUMMARY.QTY_ORDERED) DESC;
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stephen Daugherty
Stephen Daugherty

ASKER

I should have known the syntax would be something resembling a segment on Late Night with David Letterman....

Thanks matthewspatrick