I have a main table below Table1:
Name ID Entry_Dt
PEREZ 2000 8/14/2014
PEREZ 2000 8/29/2017
Domingo 2098 8/29/2017
I have another table2 below:
kid_id Parent_id
2098 2000
I would like my result like this:
Name Kid_id Parent_id Entry_dt
PEREZ 2000 8/14/2014
PEREZ 2000 8/29/2017
Domingo 2098 8/29/2017
I have used two different methods like example below but the result is not desirable.
1: union method
select *
FROM Table1 A INNER JOIN Table2 b
ON A.ID= B.Kid_id
union
select *
FROM Table1 A INNER JOIN Table2 b
ON A.ID= B.Parent_id
2: left join method:
select *
FROM Table1 A LEFT JOIN Table2 b
ON (A.ID= B.Kid_id or A.ID = B.Parent_id)
Why are my methods not working? Any ideas for improving?