For every person in column D with number in it.
I need to find person's last name from 2nd table.
select
a.TIME_STAMP,
a.RDATE,
a.TYPE,
a.PERSON
from table1 a
table2 has person's lastname and field is called last
I tried
select
a.TIME_STAMP,
a.RDATE,
a.TYPE,
a.PERSON,
b.last,
from table1 a, table b
where a.PERSON = b.PERSON
and it outputs following by removing ABC_CHANGE from the result
How can I fix query so it won't remove ABC_CHANGE.
I am doing this in crystal report just for extra information but it does same in SQLPlus.
If you want all rows in table A, even if there isn't a match in table B, you need to use a LEFT OUTER JOIN:
select
a.TIME_STAMP,
a.RDATE,
a.TYPE,
a.PERSON,
b.last,
from table1 a
LEFT OUTER JOIN table b ON a.PERSON = b.PERSON