此查询有什么问题?我在data.RN_RUN_ID处收到标识符错误。 错误附在此处:https://i.stack.imgur.com/cdZMM.jpg
ORA-00904: "STP"."ST_RUN_ID": invalid identifier
我正在尝试在ALM(应用程序生命周期管理)仪表板模块中运行此查询。如果我们为列创建了别名,或者仅仅因为我在该列中使用了聚合函数,我们是否不能使用实际的列名?
Select
data.CF_ITEM_ID as"Test set folder ID" ,
data.CF_Item_name as "Test Set folder name" ,
data.CF_Father_ID,
data.CY_CYCLE_ID as "Test Set ID",
data.CY_CYCLE as "Test Set Name" ,
data.TC_TEST_ID as "Test ID",
data.TS_Name as "Test Case Name",
data.RN_RUN_ID as "Last RUN ID" ,
data.RN_Status as "Last Run Status",
data.RN_Execution_Date as "Run Execution Date",
data.RN_Execution_Time as "Run Execution Time" ,
stp.ST_Actual as "ST Actual" ,
stp.ST_Expected as "ST Expected" ,
stp.ST_Description as "ST Description" ,
stp.ST_Status as "Step Status"
FROM (SELECT CF_ITEM_ID as"Test set folder ID" ,
CF_Item_name as "Test Set folder name" ,
CF_Father_ID,
CY_CYCLE_ID as "Test Set ID",
CY_CYCLE as "Test Set Name" ,
TC_TEST_ID as "Test ID",
TS_Name as "Test Case Name",
MAX(RN_RUN_ID) as "Last RUN ID" ,
RN_Status as "Last Run Status",
RN_Execution_Date as "Run Execution Date",
RN_Execution_Time as "Run Execution Time"
from CYCL_FOLD
Inner Join CYCLE ON CF_ITEM_ID = CY_FOLDER_ID
Inner join TESTCYCL on CY_CYCLE_ID = TC_CYCLE_ID
Inner join TEST on TC_TEST_ID = TS_TEST_ID
Inner Join RUN on TC_TEST_ID = RN_TEST_ID
group by CF_Father_ID ,CF_ITEM_ID ,CF_Item_name,CY_CYCLE_ID,
CY_CYCLE,TC_TEST_ID,TS_Name,
RN_Status,RN_Execution_Date,RN_Execution_Time) As data , (Select ST_Actual as "ST Actual" ,
ST_Expected as "ST Expected" ,
ST_Description as "ST Description" ,
ST_Status as "Step Status" from step ) As stp where data.RN_RUN_ID = stp.ST_RUN_ID
答案 0 :(得分:1)
显然,子查询中不存在列stp.ST_RUN_ID
:
Select ST_Actual as "ST Actual" ,
ST_Expected as "ST Expected" ,
ST_Description as "ST Description" ,
ST_Status as "Step Status" from step ) As stp
如果列ST_RUN_ID
实际存在于表本身中并不重要。如果您没有在子查询中命名,则它不可用。
解决方案?只需添加它,如:
Select ST_Actual as "ST Actual" ,
ST_Expected as "ST Expected" ,
ST_Description as "ST Description" ,
ST_Status as "Step Status",
ST_RUN_ID
from step) As stp