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 |
|
algorithm
Starting Member
6 Posts |
Posted - 2008-07-18 : 15:44:14
|
| I presume this is possible to do in SQL Server, but I can't figure it out.I have a table which is something like thisNumber Weighting1234 16789 11234 16789 0.53456 0.57890 0.51234 0.1Basically it is a finite list of 'Numbers' (approx 30 variations), with associated weightings. Each of the 'Numbers' is stored in a seperate table, say Number_List. There ARE duplicate rows, which I know that we hate that, it's ok for me here.So what I want to do is write a query does something like; - for each entry in Number_List (i.e. each number) - add together the weightingSo at the end I wish to be left with a list of the numbers and the grand-total of the 'Weightings'.Does this make sense? I'd be really grateful for any guidance on this.Thanks in advance. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
algorithm
Starting Member
6 Posts |
Posted - 2008-07-18 : 16:19:09
|
Wow Tara - you're a genius. Thanks SO much, I spent a while trying to figure this out. I really really appreciate this. quote: Originally posted by tkizer SELECT Number, SUM(Weighting) AS WeightingFROM YourTableGROUP BY NumberTara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
|
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|