left join带回的记录多于应有的记录

时间:2013-05-22 17:08:20

标签: sql sas

我正在尝试做一个简单的加入,我不确定这里发生了什么。我有两个表:pend_bominv_det有305行,alldet有12k左右

我正在尝试从pend_bominv_det获取所有305条记录,并且只搜索与alldet的索赔号相匹配的记录。有什么想法吗?

select distinct c_clm

,manager_name
,'exp_bom' as categ
,time_prd_nm
,report_month
,report_year
,report_end_date
from IN.pend_bominv_det a
left outer join IN.alldet
on a.pearl_clmno = c_clm
where a.pearl_clmno is not null 
and time_prd_nm = 'WEEK 2'

1 个答案:

答案 0 :(得分:0)

pend_bominv_det表中是否有多个相同声明号的实例?我想你应该在这里使用正确的联接。

希望这有帮助

相关问题