[英]Outer join in classic Oracle join syntax
I need to convert my query to classic Oracle join syntax because I need to put it in a materialized view. 我需要将查询转换为经典的Oracle联接语法,因为我需要将其放入实例化视图中。 However, I'm not quite sure how to do it: 但是,我不太确定该怎么做:
SELECT * FROM transactions t
LEFT JOIN transac_detail td1 ON (t.id = t1.trans_id AND t.ttype = 'VOICE')
LEFT JOIN transac_detail td2 ON (t.id = t2.trans_id AND t.ttype = 'BROADBAND');
I started writing it like this: 我开始这样写:
SELECT * FROM transactions t, transac_detail td1, transac_detail td2
WHERE t.id = t1.trans_id(+) AND t.id = t2.trans_id(+)
But how can I include the "literal" conditions? 但是,如何包含“文字”条件?
The original query confused. 原始查询感到困惑。 do you mean this? 你是这个意思吗
SELECT t.* FROM transactions t, transac_detail td1
WHERE t.id = td1.trans_id(+)
and t.ttype = 'VOICE'
union
SELECT t.* FROM transactions t, transac_detail td2
WHERE t.id = td2.trans_id(+)
and t.ttype = 'BROADBAND'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.