EarlyLeaveHrs time(7) -- how to sum time field in sql
Data
01:18:00.0000000
04:56:00.0000000
00:00:00.0000000
00:15:00.0000000
00:55:00.0000000
reesult will get - 00:00:00 - this format
EarlyLeaveHrs time(7) -- how to sum time field in sql
Data
01:18:00.0000000
04:56:00.0000000
00:00:00.0000000
00:15:00.0000000
00:55:00.0000000
reesult will get - 00:00:00 - this format
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chetan SanghaniPosted Aug 2, 2024, 10:11 AM
Try this query:
Naveen KumarPosted Aug 2, 2024, 9:30 AM
To sum TIMEandHH:MM:SS format, you can use a combination of SQL functions. SQL Server does not directly support summing TIMEpainTIME is designed for a specific point in the day rather than a duration. However, you can convert the TIME values to seconds, sum them, and then convert the result back to the HH:MM:SS format.
Here's a step-by-step approach to achieve this:
Convert TIME to seconds.
Sum the seconds.
Convert the total seconds back to HH:MM:SS.
Here’s how you can do it in SQL Server:
Nikunj SatasiyaPosted Jul 27, 2024, 7:48 PM
Hi Lejo, Can you try this:
Jithu ThomasPosted Jul 26, 2024, 3:14 PM
1. Convert the time to seconds.
2. Sum the seconds.
3. Convert the summed seconds back to the `HH:mm:ss` format.