Link to home
Start Free TrialLog in
Avatar of dkilby
dkilbyFlag for Canada

asked on

MS SQL Merging data from table into another table

I have a staging table where data gets inserted throughout the day, then at the end of the day I want a query that takes all the data and inserts it into another table, merging data though where the callID is the same

So in the staging table

CALLID TimeOfCall  TimeAfter Call

Main Table has same fields, but staging table could have multiple rows with the same CALLID, so when moved any data with the same CALLID would be merged adding up the TimeOfCall field of all the row with same CALLID and TimeAfterCall and the inserting this data as one row into the main table.

Is this possible ? If so how ?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial