P
pvdalen
Hi all,
This seems a little strange, but I have this query:
SELECT Worker.WorkerName, Sum((DateDiff("n",([taskall].[dateordered] & " " &
[taskall].[timein]),([taskall].[datecompleted] & " " &
[taskall].[timeout]))/60)) AS [Task Hours]
FROM Worker RIGHT JOIN TaskAll ON Worker.WorkerID = TaskAll.WorkerID
WHERE (((TaskAll.DateOrdered) Between #8/28/2005# And #8/30/2005#))
GROUP BY Worker.WorkerName;
which works just fine. The correct total of hours is shown in the second
column as expected. However, if I try to get the daily average of those
hours worked, changing only "Sum" to "Avg" in the query above:
SELECT Worker.WorkerName, Avg((DateDiff("n",([taskall].[dateordered] & " " &
[taskall].[timein]),([taskall].[datecompleted] & " " &
[taskall].[timeout]))/60)) AS [Task Hours]
FROM Worker RIGHT JOIN TaskAll ON Worker.WorkerID = TaskAll.WorkerID
WHERE (((TaskAll.DateOrdered) Between #8/28/2005# And #8/30/2005#))
GROUP BY Worker.WorkerName;
I get, in the second column, anything but the correct number. It seems,
from the results, as if the system is dividing the total hours by a multiple
of the days indicated (?). Anyone have any clues? Does the AVG function not
work so well with the DateDiff function?
Thanks very much,
Paul
This seems a little strange, but I have this query:
SELECT Worker.WorkerName, Sum((DateDiff("n",([taskall].[dateordered] & " " &
[taskall].[timein]),([taskall].[datecompleted] & " " &
[taskall].[timeout]))/60)) AS [Task Hours]
FROM Worker RIGHT JOIN TaskAll ON Worker.WorkerID = TaskAll.WorkerID
WHERE (((TaskAll.DateOrdered) Between #8/28/2005# And #8/30/2005#))
GROUP BY Worker.WorkerName;
which works just fine. The correct total of hours is shown in the second
column as expected. However, if I try to get the daily average of those
hours worked, changing only "Sum" to "Avg" in the query above:
SELECT Worker.WorkerName, Avg((DateDiff("n",([taskall].[dateordered] & " " &
[taskall].[timein]),([taskall].[datecompleted] & " " &
[taskall].[timeout]))/60)) AS [Task Hours]
FROM Worker RIGHT JOIN TaskAll ON Worker.WorkerID = TaskAll.WorkerID
WHERE (((TaskAll.DateOrdered) Between #8/28/2005# And #8/30/2005#))
GROUP BY Worker.WorkerName;
I get, in the second column, anything but the correct number. It seems,
from the results, as if the system is dividing the total hours by a multiple
of the days indicated (?). Anyone have any clues? Does the AVG function not
work so well with the DateDiff function?
Thanks very much,
Paul