select tempTable.maxMinute,tempTable.updateBy,tempTable.totalTime,tempTable.pages, tempTable.totalTime/tempTable.pages from
(
max(programEndTime - assignTaskTime) as maxMinute,
min(programEndTime - assignTaskTime) as minMinute ,
select
tb_Task.updateBy,sum(datediff(minute,assignTaskTime, programEndTime))as totaltime,sum(testTable.numColumn) as pages
from tb_task left join
(select taskID,case ISNUMERIC(pages) when 1 then cast(pages as int) end as numColumn from tb_TypesetYellowForm ) testTable
on tb_Task.taskID=testTable.taskID group by tb_Task.updateBy) as tempTable
select要放前面