0
我有一個(現在徹底導出)CTE:甲骨文左聯接返回沒有行
feature_id | function_id | group_id | subgroup_id | type_id
1 1 null 1 null
1 1 null null 14
2 1 null 5 null
2 1 null null 21
3 1 null 7 null
3 1 null null 5
我試圖整理在一起使用該行:
select C1.feature_id, C1.function_Id, C2.Group_ID, C3.Subgroup_ID, C4.Type_id
from CTE C1
left join CTE C2
on C1.feature_id = C2.feature_id
and c1.function_id = c2.function_id
and c2.group_id is not null
left join CTE C3
on C1.feature_id = C3.feature_id
and c1.function_id = c3.function_id
and c3.subgroup_id is not null
left join CTE C4
on C1.feature_id = C4.feature_id
and c1.function_id = c4.function_id
and c4.type_id is not null
這給我0行。 ..
爲了驗證,我跑:
select *
from CTE C1
選擇236行
任何人都可以幫忙嗎?當然從C1行應該回來...
編輯:固定它與Oracle語法:
select C1.feature_id, C1.function_Id, C2.Group_ID, C3.Subgroup_ID, C4.Type_id
from CTE C1, CTE C2, CTE C3, CTE C4
where C1.feature_id = C2.feature_id(+)
and c1.function_id = c2.function_id(+)
and C2.group_id(+) is not null
...
(我討厭甲骨文語法)
這應該只返回0行,如果'CTE'有:與Oracle語法固定它沒有行。你確定你沒有「where」條款嗎? –
@GordonLinoff這就是我的想法,但沒有 – JohnHC
'和c2.group_id不爲空'所有group_ids都爲空? – artm