NorthStarDA
IS-IT--Management
Hello again folks,
I have a query for a report that totals times and puts them into a graph, Im using the TIME_TO_SEC function to do the math and it appears that the SEC_TO_TIME function is not working properly when the seconds is 6 digits long. Here is my query and a sample output is below:
This query works fine (thanks tony groves) in the fact that it gives me total times worked on any given project in the dates i specify, but this is my output:
The total seconds I believe to be accurate and for the most part, TOTAL_TIME is accurate also, except for project 10. It is showing 136583 seconds in that project which comes to just under 38 hours, but the TOTAL_TIME is only showing under 14 hours. It seems that any TOTAL_SECONDS value greater than 6 digits comes out wrong in TOTAL_TIME.
Can anyone help?
I have a query for a report that totals times and puts them into a graph, Im using the TIME_TO_SEC function to do the math and it appears that the SEC_TO_TIME function is not working properly when the seconds is 6 digits long. Here is my query and a sample output is below:
Code:
SELECT h.project_id,h.time_in,h.time_out,p.name,p.id,
SEC_TO_TIME(SUM(TIME_TO_SEC(h.time_out)-TIME_TO_SEC(h.time_in))) TOTAL_TIME,
SUM(TIME_TO_SEC(h.time_out)-TIME_TO_SEC(h.time_in)) AS TOTAL_SECONDS
FROM work_history h,projects p
WHERE h.work_date BETWEEN #CreateODBCDate(URL.from)# AND #CreateODBCDate(URL.to)#
AND p.ID = h.project_id
GROUP BY p.ID ORDER BY p.name
This query works fine (thanks tony groves) in the fact that it gives me total times worked on any given project in the dates i specify, but this is my output:
Code:
name TOTAL_TIME TOTAL_SECONDS
project1 08:40:10 -- 31210
project2 20:08:13 -- 72493
project3 14:13:56 -- 51236
project4 05:42:19 -- 20539
project5 09:23:49 -- 33829
project6 06:40:44 -- 24044
project7 01:55:22 -- 6922
project8 09:54:39 -- 35679
project9 09:13:44 -- 33224
project10 13:56:23 -- 136583
The total seconds I believe to be accurate and for the most part, TOTAL_TIME is accurate also, except for project 10. It is showing 136583 seconds in that project which comes to just under 38 hours, but the TOTAL_TIME is only showing under 14 hours. It seems that any TOTAL_SECONDS value greater than 6 digits comes out wrong in TOTAL_TIME.
Can anyone help?