我有一个程序,它为具有“工人”头衔的评估人员带来技能评级,他们必须携带分配给他们的文件编号。该程序还引入了每个工人所属的报告线。
SELECT distinct
o.VP,
o.AVP,
o.Director,
o.Supervisor,
o.Worker,
bs.File_NBR,
s.Skill
bs.score
FROM [New_EEs].[dbo].[SBC_Best_Scores] bs
inner join new_ees.dbo.SBC_Skills s
on bs.Skill_NBR=s.SKILL_NBR
inner join gw_PPP.dbo.Org_Hierarchy oon
bs.File_NBR=o.File_NBR;
我得到一个看起来像这样的数据集:
VP AVP Director Supervisor Worker File_NBR Skill Rating
Gerald Kris Doris NULL Mack 107812 B2 4
Gerald Kris Doris NULL Mack 107812 D1 3
Gerald Kris Doris NULL Mack 107812 D2 3
Gerald Kris Doris NULL Mack 107812 D3 3
Gerald Kris Doris NULL Mack 107812 E1 4
Gerald Kris Mike NULL Brady 109080 A1 5
Gerald Kris Mike NULL Brady 109080 B1 4
Gerald Kris Mike NULL Brady 109080 B2 3
Gerald Kris Mike NULL Brady 109080 B3 4
Gerald Kris Mike NULL Brady 109080 C1 4
Gerald Kris Mike NULL Brady 109080 C2 4
Gerald Kris Mike NULL Brady 109080 C3 0
Kim Harry NULL Grant Tom 108457 B1 4
Kim Harry NULL Grant Tom 108457 B2 4
Kim Harry NULL Grant Tom 108457 C1 4
Kim Harry NULL Grant Tom 108457 C2: 5
Kim Harry NULL Grant Tom 108457 C5 5
Kim Harry NULL Grant Tom 108457 D1 4
Kim Harry NULL Grant Tom 108457 D2 5
Kim Harry NULL Grant Tom 108457 D3 4
Kim Harry NULL Grant Jean 106934 C5 4
Kim Harry NULL Grant Jean 106934 D1 5
Kim Harry NULL Grant Jean 106934 D3 5
Kim Harry NULL Grant Raphe 108901 B2 5
Kim Harry NULL Grant Raphe 108901 C2 5
Kim Harry NULL Grant Raphe 108901 C3 4
Kim Harry NULL Grant Raphe 108901 C5 5
Kim Harry NULL Grant Raphe 108901 D2 5
Kim Harry NULL Grant Raphe 108901 E1 5
Kim Harry NULL Grant Tyika 107923 B1 5
Kim Harry NULL Grant Tyika 107923 B2 5
Kim Harry NULL Grant Tyika 107923 D2 4
Kim Harry NULL Grant Tyika 107923 D3 4
评级级别为 1 到 5。我需要做的是创建一个表格,显示按 Vp、AVP、主管和主管分组的每种技能对工人的每个评级的计数和百分比。所以所有最终都在 AVP 之下的作品和所有最终在导演之下的作品等等。
Name Role Skill Count of % of Count of % of
Rating 1 Rating 1 Rating 2 Rating 2
Gerald VP A1 100 29% 130 33%
Gerald VP B1 95 28% 95 24%
Gerald VP B2 120 35% 70 18%
Gerald VP B3 30 9% 100 25%
Kim VP A1
Kim VP B1
Kim VP B2 and so on
Kim VP B3
Kris AVP A1
Kris AVP B1
Kris AVP B2
Kris AVP B3
Harry AVP A1
Harry AVP B1
Harry AVP B2
Harry AVP B3
Doris Director A1
Doris Director B1
Doris Director B2
Doris Director B3
Mike Director A1
Mike Director B1
Mike Director B2
Mike Director B3
Grant Supervisor A1
Grant Supervisor B1
Grant Supervisor B2
Grant Supervisor B3
任何帮助都会很棒!谢谢!