Dear All,
I am trying following query and getting following output.
I want the desired output.
How to sum of total with the primary key value ?
Query:
SELECT Emp_ID,cast(sum(datediff(second,0,Short_Extra_Hour_days))/3600 as varchar(12)) + ':' +
right('0' + cast(sum(datediff(second,0,Short_Extra_Hour_days))/60%60 as varchar(2)),2) AS Total
FROM [HRMS_TEST].[dbo].[M_SHORT_EXTRA_HOURS]
group by Emp_ID,Short_Extra_Hour_Type
Output:
EMPID TOTAL
10 2:00
10 9:30
9 3:30
Desired Output:
EMPID TOTAL
10 11:30
9 3:30
Thanks,
Harish Patil