I actually need this. I have been asked to graph budgets in two different ways. So it's really two query challenges. I don't know if they can be done with queries at all.
Subtask records have a name field, authorized date field, due date field, and an authorized hours field. Queries turn these fields into a weekly budget field by subtracting the due date from the authorized date, turning that into a "weeks remaining", and dividing that into the hours. The weekly budget for a task containing these subtasks is defined as the sum of the individual weekly budgets at a given time.
Let's say my subtask table looks like this:
A 2000 1/1/98 6/1/98
B 3200 3/1/98 7/1/98
and the weekly budgets, calculated in the query, are:
A 100
B 200
...assuming exactly 4 weeks/month for simplicity.
One way to represent the above example is to graph a query which would look like this:
1/1/98 100
3/1/98 300
6/1/98 200
7/1/98 0
so I would need to figure out how to make such a cursor. Another way I have been asked to represent these amounts is to show the total expenditure that the budget allows over time:
1/1/98 0
3/1/98 800
6/1/98 4400
7/1/98 5200
The above queries contain, I think, the minimum necessary points for graphing. Writing code that scans the tables and writes cursors can be done, but it would be cool to do it with a SELECT - SQL.
Thank you.