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 |
|
archanasql
Starting Member
27 Posts |
Posted - 2008-07-29 : 11:07:00
|
| Hi ,I have two tables with some data.I would like to add the data of a common column to a new table..table 11 abc 60002 xyz 3000table 21 abc 40002 xyz 2000I want output into new table TABLE3 by merging the above two tablesTable31 abc 100002 xyz 5000kindly let me the know the query.. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-29 : 11:14:07
|
| [code]INSERT INTO table3(field1,field2,field3)SELECT field1,field2,SUM(field3) AS field3 FROM(SELECT field1,field2,field3FROM table 1UNION ALLSELECT field1,field2,field3FROM table 2)tGROUP BY field1,field2[/code] |
 |
|
|
|
|
|