I'm working on a mini-scheduler, and I'm not sure how to do what I want to do with SQL. I think it'll be easiest to show the data I've got and what I want...
From this, I want to get...
P.S. If you want the data...
Code:
Task ManHours Person Pri
Clean up the room 16 Bob 2
Clean up the room 16 Lucy 1
Clean up the room 8 George 2
Feed the dog 8 George 1
Take out the trash 16 Bob 1
Take out the trash 16 Lucy 1
From this, I want to get...
Code:
Task DaysToCompletion
Clean up the room 2
Feed the Dog 1
Take Out the Trash 1
P.S. If you want the data...
Code:
select
'Take out the trash' as task,'16' as manhours,'Bob' as person,'1' as priority into #tmp union
select
'Clean up the room','16','Bob','2' union
select
'Clean up the room','16','Lucy','1' union
select
'Take out the trash','16','Lucy','1' union
select
'Feed the dog','8','George','1' union
select
'Clean up the room','8','George','2'