oracle left join 注意事项

在orcle left join 中,若左表 连接 右表 时,的连接条件是一对多时。会出现查询的结果比原来增多的情况。这需要对于右表 去重复。

右表替换如下

select j.*,rowid from tablea j where j.code in (select   k.code from   tablea k where k.report_date='2016' group by k.code having 
count(k.region_code) = 1) 

如此 再left join ok 了!

posted @ 2018-03-30 12:06  飞花落  阅读(885)  评论(0编辑  收藏  举报