我目前运行查询:计算基于从查询结果中的百分比
select table1.columnA as Barrier_1,
table2.columnB as Action_1,
from table2
join table1 on table2.PrimKey = table1.PrimKey
where table1.columnA is not null
and table2.columnB is not null
group by table1.columnA, table2.columnB
order by table1.columnA
返回表:
Barrier_1 Action_1
____________________
01 | 01
01 | 02
02 | 01
02 | 03
02 | 04
03 | 02
03 | 03
04 | 01
05 | 04
,我希望它做的是计算每个百分比每个屏障的操作:
Barrier_1 Action_1 Percent_1
________________________________
01 | 01 | 60%
01 | 02 | 40%
02 | 01 | 20%
02 | 03 | 10%
02 | 04 | 70%
03 | 02 | 20%
03 | 03 | 80%
04 | 01 | 100%
05 | 04 | 100%
请注意,每个操作可以显示每个屏障的多个时间。
因此,每个障碍都有自己的一套行动。例如,障碍物可以总共有5个动作(2个为动作02,3个为动作01)。
你能对你的意思是'什么扩大每个屏障的每个动作的百分比? –
你用什么公式来计算每一行。例如屏障05与行动04.行动04存在两次屏障05只有一次为什么它是100%vs屏障04与行动01(有3个条目)在100%? – xQbert
所以每个障碍都有自己的一套行动。例如,障碍物可以总共有5个动作(2个为动作02,3个为动作01)。希望能够回答这两个问题。 – rjbogz