Take these two example tables:
Table A
Name FirstOrLast
Jeremy First
Smith Last
Mark First
David First
Table B
Name
Jeremy
Smith
Mark
David
Jones
Jack
I would like the output to be this: Output only first names, but if Table A doesn’t record if it’s a first or last name, output it anyway. The correct output would be:
Jeremy
Mark
David
Jones
Jack
I’ve tried accomplishing this with an outer join, like so:
select
B.Name
from
A, B
where
A.name = B.name(+) and
A.FirstOrLast = 'First';
but no luck. How can I do this?
When you perform a left outer join and there is no record in
A,a.firstOrLastwill be null. While you’re at it, you might as well switch to the standard syntax for joins:However, the old syntax should also work: