I am tracking the use of a resource with the following table structure:
rID rDateTime rStatus
My status is basically "in use" (1) or "idle" (0) and a record is written each time the resource goes in and out of each status.
I am calculating the number of hours that a resource is "in use" by using a subquery to find the next time the resource was "idle" so I end up with:
rID TimeInUse
1 10
2 4
3 8
1 3
2 7
...
I need to calculate the utilization of a particular resource for various user defined time periods (day, week, month, etc) but I am having trouble because you cannot use the aggregate functions on subqueries.
Is there a better technique? Any help is appreciated.
Rene'
rID rDateTime rStatus
My status is basically "in use" (1) or "idle" (0) and a record is written each time the resource goes in and out of each status.
I am calculating the number of hours that a resource is "in use" by using a subquery to find the next time the resource was "idle" so I end up with:
rID TimeInUse
1 10
2 4
3 8
1 3
2 7
...
I need to calculate the utilization of a particular resource for various user defined time periods (day, week, month, etc) but I am having trouble because you cannot use the aggregate functions on subqueries.
Is there a better technique? Any help is appreciated.
Rene'