select
b.columnb,
case when a.columna is null then 'FALSE' else 'TRUE' end
from
tableb b left outer join
tablea a on b.columnb = a.columna
在上面的查询中,我怎么能再包含一个条件才能看到' False'值?
感谢。
答案 0 :(得分:1)
嗯,你可以:
答案 1 :(得分:1)
只需将WHERE
添加到您的SELECT
声明中:
select
b.columnb,
case when a.columna is null then 'FALSE' else 'TRUE' end
from
tableb b
left outer join tablea a on (b.columnb = a.columna)
WHERE a.columna IS NULL;
在这种情况下,您可以将其简化为:
SELECT
b.columnb,
'FALSE'
FROM
tableb b
LEFT OUTER JOIN tablea a ON (b.columnb = a.columna)
WHERE a.columna IS NULL;