SELECT TOP fast way...

User avatar
sal21
PlatinumLounger
Posts: 4357
Joined: 26 Apr 2010, 17:36

SELECT TOP fast way...

Post by sal21 »

SELECT TOP 6 VE.ANNO FROM VE GROUP BY ANNO

is this the fast way to extract top 6 ANNO in Access table with approx 165.xxx records?

Note:
ANNO is indexed

User avatar
HansV
Administrator
Posts: 78513
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SELECT TOP fast way...

Post by HansV »

Yes.
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78513
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SELECT TOP fast way...

Post by HansV »

By the way, if you want to select the 6 most recent years, you must sort in descending order:

SELECT TOP 6 ANNO FROM VE GROUP BY ANNO ORDER BY ANNO DESC
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4357
Joined: 26 Apr 2010, 17:36

Re: SELECT TOP fast way...

Post by sal21 »

HansV wrote:By the way, if you want to select the 6 most recent years, you must sort in descending order:

SELECT TOP 6 ANNO FROM VE GROUP BY ANNO ORDER BY ANNO DESC
TKS!