Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-08-29 : 07:53:31
|
| Doug Villhard writes "How do you sum the top x rows in a query?" |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-08-29 : 08:02:13
|
You could use a derived table:SELECT SUM(Sales) AS SumOfSales FROM (SELECT TOP 10 ProductID, SUM(Sales) AS SalesFROM Product_SalesGROUP BY ProductIDORDER BY SUM(Sales)) AOwais Make it idiot proof and someone will make a better idiot |
 |
|
|
|
|
|