Skip to content
Advertisement

How to merge two rows having same data?

i have a table with some data i want to merge the identical row i.e.as shown in image two identical rows having same tDateWorked,empid,jobid i want to merge this records so that OT and ST should appears in same line.

enter image description here

Advertisement

Answer

You can use aggregation:

select tDateWorked, empId, craftCodeId, jobId,
       sum(ot) as ot, sum(st) as st
from t
group by tDateWorked, empId, craftCodeId, jobId;
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement