troubleshooting Question

LIMIT ROWS RETURNED IN ACCESS QUERY

Avatar of Stephen Daugherty
Stephen Daugherty asked on
SQL
2 Comments1 Solution4591 ViewsLast Modified:
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;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros