By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,835 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,835 IT Pros & Developers. It's quick & easy.

Select Top 20 Problem

P: 1
Hi - I'm using Access 2002 SP3 and have the following query which is retunring more than the Top 20 to me. I've tried everything I can think of but would appreciate any help. Sorry if it is a silly question but I'm quite new to Access.

SELECT TOP 20 [tbl - MGC Names].[Master No Name], Sum([MID 2 Extract Data].CountOK) AS SumOfCountOK
FROM [MID 2 Extract Data] INNER JOIN ([tbl - Agent Names] INNER JOIN [tbl - MGC Names] ON [tbl - Agent Names].[Master No Name] = [tbl - MGC Names].[Master No Name]) ON [MID 2 Extract Data].Field15 = [tbl - Agent Names].[Agency No]
GROUP BY [tbl - MGC Names].[Master No Name]
ORDER BY [tbl - MGC Names].[Master No Name];

This query returns 28 records which is all that is on the table.
Jun 5 '07 #1
Share this Question
Share on Google+
1 Reply

MMcCarthy
Expert Mod 10K+
P: 14,534
Try this

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT TOP 20 Sum([MID 2 Extract Data].CountOK) AS SumOfCountOK, [tbl - MGC Names].[Master No Name]
  3. FROM [MID 2 Extract Data] INNER JOIN ([tbl - Agent Names] INNER JOIN [tbl - MGC Names] ON [tbl - Agent Names].[Master No Name] = [tbl - MGC Names].[Master No Name]) ON [MID 2 Extract Data].Field15 = [tbl - Agent Names].[Agency No]
  4. GROUP BY [tbl - MGC Names].[Master No Name]
  5. ORDER BY Sum([MID 2 Extract Data].CountOK) AS SumOfCountOK;
  6.  
Jun 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.