I have a work plan in DB as follows. For instance, the first row means that Team A has 10 hours’ work to do in June (SP1006).
Team Sprint WorkHours A 1006 10 A 1007 20 A 1008 30 A 1009 40 B 1008 50 B 1009 60 B 1010 70
I want to derive it into the following form to show: at the end of each month, how many hours are left to be done, according to the work plan. As you see, the fields of the derived table depend on the original datatable too.
Team SP1005 SP1006 SP1007 SP1008 SP1009 SP1010 A 100 90 70 40 0 0 B 180 180 180 130 70 0
I’m trying to do this on SQL Server 2000. This is really hard for me. Can someone give some help? Thanks a lot!
Edit: Or you can ignore the row-to-column transformation part, (which I know how to do,) just concentrate on the accumulation part.
For the accumulation part use a cursor. Unless the result set is very small (maybe <100 rows to process) when you can get away with a triangular join like.
But as the number of rows grows the amount of work required by the triangular join grows exponentially.