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 |
|
lydia
Starting Member
34 Posts |
Posted - 2012-03-06 : 06:04:25
|
| I would like to summary table_A and Table_B as below:Table_AField_1 | Field_2 |--------------------Mr.A | 100Mr.B | 300Mr.C | 150Mr.D | 400Table_BField_1 | Field_2 |--------------------Mr.T | 50Mr.A | 30Mr.Y | 80Mr.B | 90Result:Field_1 | Field_2 |--------------------Mr.A | 130Mr.B | 390Mr.C | 150Mr.D | 400Mr.T | 50Mr.Y | 80Thanks inadvance :) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-06 : 06:46:01
|
[code]select Field_1, sum(Field_2)from( select Field_1, Field_2 from Table_A union all select Field_1, Field_2 from Table_A) fgroup by Field_1[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
lydia
Starting Member
34 Posts |
Posted - 2012-03-14 : 03:10:43
|
| Thanks for your help :) |
 |
|
|
|
|
|