Reputation: 13
I have a table that shows regular hours & overtime hours. Because of the way the old system exported the data, for many Pay Periods, I ended up with 2 records for each Pay Period - one for regular hours and another for overtime. Is there an easy way in SQL to add the overtime to same record with as the regular hours and then delete the overtime record?
Upvotes: 0
Views: 55
Reputation: 1269463
You should be able to use aggregation:
select accountingid, payperiodenddate,
sum(regularhours) as regularhours, sum(othours) as othours
from t
group by accountingid, payperiodenddate;
Upvotes: 1