I have data like this:
Task | Hours
1.1 | 40
2 | 40
2.1 | 60
2.1.1 | 15
15.9 | 24
16 | 5
19.1 | 40
19.1.1 | 8
19.1.2 | 12
19.2 | 6
19.2.1 | 21
19.2.2 | 15
19.2.3 | 2
19.3 | 64
I would like to group based on the first two levels of the Task, producing this result:
Task | Hours
1.1 | 40
2 | 40
2.1 | 75
15.9 | 24
16 | 5
19.1 | 60
19.2 | 44
19.3 | 64
I want the 16 to not roll up what's beneath it, but I need all the other levels to roll up. This is SQL Server 2005. I would normally do a split on the decimal, and break it out that way, but I was wondering if there's a better way to do it in SQL.