如何在没有任何重复行的情况下连接两个表中的表?

问题描述 投票:0回答:1

我有一个用ibm db2 sql编写的查询,我想在cognos框架工作管理器(FWM)中使用它。该查询使用多个连接与其他表,并在多个硬编码日期连接。我想在FWM中加入查询而不考虑日期逻辑,但我很害怕它可能会创建多行。我怎么加入呢?

select ,emp_id,paid_amount ,outstanding_amt
from employees_tab e
join  reserve_table  c
on c.emp_id = e.emp_id
and  effective _date <'2018-01-01' and (end_date is null or end_date >= '2018-02-01'
sql sql-server date db2 cognos-10
1个回答
0
投票

试试吧:

select emp_id, paid_amount ,outstanding_amt
from employees_tab e
join  reserve_table  c
on c.emp_id = e.emp_id
where effective _date <'2018-01-01' and (end_date is null or end_date >= '2018-02-01');
© www.soinside.com 2019 - 2024. All rights reserved.