如何获取执行缓慢的任务列表?

时间:2014-03-09 01:00:45

标签: sql-server qsqlquery

Schems DataBase 示例报告:

TASK_的 __ | _Percent_Executing | _Executing_0f_day_ | 标题 |

Task_1 | 20 | 12 | ТрудягинТ.Т。 |

Task_2 | 90 | 7 | ИсполнительныйИ.И。 |

Task_3 | 50 | 7 | ТрудягинТ.Т。 |

** 为了履行职责,负责监督的人必须确定其他相对过慢的任务。为此,应负责监督报告,包括10(或更少)用于缓慢运行的任务。**

SELECT TOP 10 ta.problemStatement AS N'Задача',
    --emp.firstName AS N'Исполнитель',
    DATEDIFF(dd,MIN(startDate),MAX(startDate)) AS N'Количество дней',
    MAX(percent100) AS N'Процент',
    MAX(startDate)/*,
    (SELECT firstName FROM Version AS ve INNER JOIN Employee AS emp
       ON ve.id_employee_leader = emp.id 
     WHERE ve.startDate IN (MAX(startDate)))*/
FROM 
  Version AS ve INNER JOIN Task AS ta
    ON ve.id_task = ta.id   
  INNER JOIN Employee AS emp
    ON emp.id = ve.id_employee_leader
  WHERE emp.id <= 15    
GROUP BY ta.problemStatement 
ORDER BY 2 DESC
GO

0 个答案:

没有答案