Jump to content

Access Sql


Guest pac1181
 Share

Recommended Posts

Guest pac1181

I am trying to create a query in Access to Group based on locations and show the Top 10 procedures by revenue. I can get the query to group the Top 10 for all locations or just one, but not the Top 10 for each group. Not very savy with SQL and could use help. The code below produces the Top 10 for all locations, just need it to group by EACH location. Any help would be appreciatedSELECT TOP 10 Sum([temp - top 10 by loc].[sumOfOI Line Changes]) AS [sumOfSumOfOI Line Changes], [temp - top 10 by loc].[Location#], [temp - top 10 by loc].[Loc Name], [temp - top 10 by loc].[Proc Key], [temp - top 10 by loc].[Proc Name], Sum([temp - top 10 by loc].[sumOfOI Line Units]) AS [sumOfSumOfOI Line Units]FROM [temp - top 10 by loc]GROUP BY [temp - top 10 by loc].[Location#], [temp - top 10 by loc].[Loc Name], [temp - top 10 by loc].[Proc Key], [temp - top 10 by loc].[Proc Name]ORDER BY Sum([temp - top 10 by loc].[sumOfOI Line Changes]) DESC , [temp - top 10 by loc].[Location#];

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...