在同一个查询中组合Oracle内部和外部联接是否有效la:
select b.col1, c.col2, sum(d.col1), sum(e.col1) from
a
inner join b on a.xxx = b.xxx
inner join c on a.yyy = c.yyy
left join d on b.aaa = d.aaa and c.bbb = d.bbb
left join e on b.aaa = e.bbb and c.aaa = e.bbb
group by b.col1, c.col2
答案 0 :(得分:0)
是的,您可以按照您认为适合查询的方式组合内部,左侧和右侧连接。只需确保您了解内部,左侧和外部联接的含义。几个博客很好地描述了联接:http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/和http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
答案 1 :(得分:0)
答案 2 :(得分:0)
请尝试此操作,所有非聚合列都应该在group by子句中。
select b.col1, c.col2, sum(d.col1), sum(e.col1) from
a
inner join b on a.xxx = b.xxx
inner join c on a.yyy = c.yyy
left join d on b.aaa = d.aaa and c.bbb = d.bbb
left join e on b.aaa = e.bbb and c.aaa = e.bbb
group by b.col1, c.col2