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 |
|
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-09-27 : 11:54:34
|
| I have the following query:SELECT TOP 10 SicDescription, COUNT(*) AS [TotalAccounts], SUM(AccountMV)AS [AccountMV], sum(AccountFeeLY) as AccountFeeLY, sicidFROM SnapsRawWHERE (Branchstate = @state) AND (SicID <> '00') AND (SicID <> '99') AND (monthend = @date)GROUP BY SicID, SicDescription, MonthEndorder by accountmv descI want to be able to right something that I can than sum up the top 10's sum values, so basically i have the top 10 of something , each with a marketvalue, i want to than add up all those market value and produce the result. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-27 : 11:59:12
|
| ???select sum(somecolumn) where pk_column in (select top 10 pk_column from sometable where ... order by...)from mytablePeter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|