" select
SEC_TO_TIME(SUM(TIME_TO_SEC(m.totalTime))) as totalDuration
from m
inner join pd on pd.candidateId = m.candidateId
where m.s_id is not null
and pd.s = 1"
OUTPUT :totalDuration: 838:59:59
"select
(SUM(TIME_TO_SEC(m.totalTime))/3600) as totalDuration
from m
inner join pd on pd.candidateId = m.candidateId
where m.s_Id is not null
and pd.s = 1"
Output:totalDuration:1207.7658
My question is why TIME_TO_SEC Function not returning desire output like in first query duration is 838:59:59 and in sec query by dividing 3600 it is shown different result 1207.7658(hr)
Range of SEC_TO_TIME() is -838:59:59 to 838:59:59. So, when we are converting seconds to time if time is greater than 838:59:59 it will always return 838:59:59 value in my case that is same issue . so I have converted sec to hour by divided by 3600.