MSSQL Insert into Table from another Table that some fields are SUM()
Posted on 2011-03-18
I have a table, OrigTable, with 8 fields in it Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8. I want to Sum() Field7 and Filed8 using the Group By Field1, Field2, Field3, Field4. Then insert all 8 Fields into NewTable as Field1, Field2, Field3, Field4, Field5, Field6, Field7 (sum value), Field8 (sum value). The Unique key in NewTable is Field1, Field2, Field3, Field4. Field5 adn Field6 could have different values but it doesn't matter which value is used the field to insert the record in NewTable. Is this possible?