我已经构建了以下查询,但是当我尝试运行它时会引发错误:
ORA-00904: "CASE_MASTER"."FOLLOWUP_DATE":
invalid identifier 00904. 00000 - "%s: invalid identifier"
*Cause:
*Action: Error at Line: 76 Column: 14
你能给我一个提示或告诉我什么是错的吗?
查询:
SELECT DISTINCT case_event_assess.case_id
FROM case_event ce
,case_event_assess
,lm_datasheet
,case_product cp
,case_assess ca
/* New AC Name: Exp: Testing query */
WHERE ce.case_id = case_master.case_id
AND ce.case_id = case_event_assess.case_id
AND ce.seq_num = case_event_assess.event_seq_num
AND case_event_assess.case_id = case_master.case_id
AND ca.case_id = case_master.case_id
AND ca.case_id = case_event_assess.case_id
AND lm_datasheet.datasheet_id = case_event_assess.datasheet_id
AND (sheet_name = 'IB' OR license_id = 0)
AND ce.case_id = cp.case_id
AND cp.seq_num = case_event_assess.prod_seq_num
AND EXISTS (
SELECT 1 FROM lm_product lp
WHERE lp.drug_code = cp.co_drug_code
OR lp.product_id = cp.pat_exposure )
AND case_master.state_id > 1
AND NOT EXISTS(
SELECT DISTINCT case_event_assess.case_id
FROM case_event_assess
WHERE case_event_assess.case_id = case_master.case_id
AND case_master.rpt_type_id IN (1, 3)
AND EXISTS (
SELECT 1 FROM lm_license
WHERE lm_license.license_id = case_event_assess.license_id
AND lm_license.country_id IN (223, 23000101)
AND lm_license.license_type_id IN (4, 6))
)
AND EXISTS(
SELECT 1 FROM lm_license
,case_event_assess cea
WHERE cea.case_id = case_master.case_id
AND cea.prod_seq_num = case_event_assess.prod_seq_num
AND cea.license_id = lm_license.license_id
AND lm_license.manufacturer_id IN (10087, 200000016, 202000406, 202000608, 202000609)
AND lm_license.country_id = 223 )
GROUP BY case_event_assess.case_id
,case_event_assess.event_seq_num
,case_event_assess.prod_seq_num
HAVING(
(/* Serious */
MIN(ce.sc_death) = 1 OR MIN(ce.sc_threat) = 1 OR MIN(ce.sc_disable) = 1 OR MIN(ce.sc_int_req) = 1
OR MIN(ce.sc_cong_anom) = 1 OR MIN(ce.sc_hosp) = 1 OR MIN(ce.med_serious) = 1 OR MIN(ce.sc_other) = 1
)
AND
( /* Unlisted*/
MIN(decode(lm_datasheet.datasheet_id, 0, 1, NULL, 1, abs(det_listedness_id - 2))) = 0
OR MIN(decode(lm_datasheet.datasheet_id, 0, 3, NULL, 3, det_listedness_id)) = 3
))
答案 0 :(得分:0)
由于case_master
- 子句中没有名为from
的表,因此您无法在where
- 子句中使用它。