CoffeeGuru
Registered User.
- Local time
- Today, 23:37
- Joined
- Jun 20, 2013
- Messages
- 121
I have an Access pass-through query that selects the top 10.
I need to be able to allow a user to select the top x
How do I pass x as a parameter to SQL Server by embedding it into my Pass-through query.
this is my code
I need to be able to allow a user to select the top x
How do I pass x as a parameter to SQL Server by embedding it into my Pass-through query.
this is my code
Code:
SELECT TOP 10 Country
,Retailer
,[Store Number]
,[Store Location]
,sum(Revenue) AS Revenue
,(SELECT sum([revenue]) FROM #SalesData52) AS Total_revenue
,sum([Revenue])/(SELECT sum([revenue]) FROM #SalesData52) AS [Rev%]
from #salesdata52
GROUP BY Country
,Retailer
,[Store Number]
,[Store Location]
ORDER BY Sum([Revenue]) DESC