1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| select TOP 4 convert(nvarchar(20), a.departmentmark) ,b.ygd,a.wgd from
(select b.departmentmark ,count(b.departmentmark) as wgd from hrmresource a,hrmdepartment b,workflow_currentoperator c where a.status not in (4,5,6,7) and a.departmentid = b.id and a.id = c.userid and c.iscomplete = 0 group by b.departmentmark) a, (select b.departmentmark ,count(b.departmentmark) as ygd from hrmresource a,hrmdepartment b,workflow_currentoperator c where a.status not in (4,5,6,7) and a.departmentid = b.id and a.id = c.userid and c.iscomplete = 1 group by b.departmentmark) b where a.departmentmark = b.departmentmark order by a.wgd desc
|