【发布时间】:2019-10-24 14:20:53
【问题描述】:
在让 Unpivot 完全按照我的意愿行事时遇到了一些麻烦,不确定是否可以在没有其他联接或联合的情况下(如果可能的话,我想避免)任何帮助将不胜感激。 :)
select *
from (select "Not Executed" + "Pass" + "Fail" + "Blocked" As "Total",
"Pass" + "Fail" + "Blocked" As "Executed",
"Pass",
"Fail",
"Blocked",
"Not Executed",
Priority
from (select TRS.NAME AS Status, TPS.Name as Priority
from TEST_RESULT TR
join (Select ID, NAME
from RESULT_STATUS
where "GROUP" = 'TEST_RESULT_STATUS') TRS
on TR.TEST_RESULT_STATUS_ID = TRS.ID
join TEST_RUN TRN
on TR.TEST_RUN_ID = TRN.ID
join TEST_CASE TC
on TC.ID = TR.TEST_CASE_ID
join (Select ID, NAME
from RESULT_STATUS
where "GROUP" = 'TEST_CASE_PRIORITY') TPS
on TC.PRIORITY_ID = TPS.ID
--Add your test cycles that you want to report on here
where TRN.KEY IN ('PSD-C3')
) pivot(count(Status) for Status in('Not Executed' as
"Not Executed",
'Pass' as "Pass",
'Fail' as "Fail",
'Blocked' as "Blocked"))) p;
返回:
Total Executed Pass Fail Blocked Not Executed PRIORITY
37 36 18 11 7 1 High
32 26 18 7 1 6 Normal
我想要的是:
Status High Normal
Total 37 32
Executed 36 26
Pass 18 18
Fail 11 7
Blocked 7 1
Not Executed 1 6
【问题讨论】: