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 |
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2011-08-10 : 02:57:14
|
Hi Guys,I need help from you..we have data like belowTable1Col1 Col2 col3 values200908 113 1077149 2200908 113 184254 1200908 113 989021 2Table2col1 col2 Proportional_Value 200908 113 1Expected Output 200908 113 1077149 2 0.400000200908 113 184254 1 0.200000200908 113 989021 2 0.400000 The Proportional_Value will be Proportionaly distributed based on the table1 column values.Thanks in advance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-10 : 04:15:08
|
[code]select t1.col1, t1.col2, t1.col3, t1.val, proportional_value * 1.0 * t1.val / sum(t1.val) over()from Table1 t1 inner join Table2 t2 on t1.col1 = t2.col1 and t1.col2 = t2.col2[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|