Select top 5 from query

AlanW

Registered User.
Local time
Today, 15:38
Joined
Aug 11, 2001
Messages
25
I have the following query. I'd like to show/select only the top 5 records. Can anyone advise me on how to do this?

SELECT DISTINCTROW PYVOAP.[AP Code], PYVOAP.[AREA OF PRACTICE], PYVOAP.[File Number], PYVOAP.[Client Surname], Sum(PYVOAP.Costs) AS [Sum Of Costs]
FROM PYVOAP
GROUP BY PYVOAP.[AP Code], PYVOAP.[AREA OF PRACTICE], PYVOAP.[File Number], PYVOAP.[Client Surname]
ORDER BY PYVOAP.[AP Code];
 
Code:
select top 5 distinctrow .....

WTF? I copied the code in capitals but the post automatically turned it to sentence case.

So I put it in a code box and it turned it all to lower case.
 
Thanks GalaxiomAtHome . . Unfortunately that doesn't work . . I get syntax errors when I try that. . I wish it were that simple ;)
 
It should work using a subquery.

SELECT TOP 5 fieldname1, fieldname2 etc
FROM (SELECT etc
 

Users who are viewing this thread

Back
Top Bottom