我有一张这样的表
execution_plan_id test_case_name results
37 LandingPage.test SKIPPED
38 LandingPage.test SKIPPED
我想要一个以下面的格式显示结果的查询。
test_case_name results for 37 result for 38
LandingPage.test SKIPPED SKIPPED
问题是,可能有多个行具有不同的execution_plan_id。所以我想要一个动态创建列的查询。此外,我将在where子句
中传递execution_plan_id答案 0 :(得分:0)
select test_case_name,
max(case when execution_plan_id = 37 then results end) result_37,
max(case when execution_plan_id = 38 then results end) result_38
from my_table
group by test_case_name;