Database 连接条件显示不适当的结果
我最近写了这个查询,在上面的查询中没有满足条件b.status='yes',status在其中显示NULL值。我想根据此条件优化我的记录。状态为“是”。请尝试以下操作:Database 连接条件显示不适当的结果,database,oracle,join,left-join,where-clause,Database,Oracle,Join,Left Join,Where Clause,我最近写了这个查询,在上面的查询中没有满足条件b.status='yes',status在其中显示NULL值。我想根据此条件优化我的记录。状态为“是”。请尝试以下操作: SELECT a.name, nvl(c.bill_amount,0), b.status FROM table_1 a left outer join table_2 b ON a.name = b.name and
SELECT a.name,
nvl(c.bill_amount,0),
b.status
FROM table_1 a left outer join table_2 b
ON a.name = b.name and
b.status = 'YES'
left outer join table_3 c on B.phone_number = C.phone_number
AND B.email = C.email
where
a.VALID = 'Y';
@请看我的最新答案。这个很好用
SELECT a.name, nvl(c.bill_amount,0), b.status
FROM table_1 a left outer join table_2 b
ON a.name = b.name
left outer join table_3 c on b.phone_number = c.phone_number
where
a.VALID = 'Y' and
b.status = 'YES' and
b.email = c.email