Возникли проблемы с тем, чтобы 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