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