beenz
beenz

Reputation: 47

oracle exercise question in my data using 2 table information

person

name   home    st
JAMES  LA      L1
MIKE   BOSTON  B1
ANTON  LA      L1
LEE    NY      N1
BROWN  NY      N2

mentor

name  m_name
JAMES ANTON
MIKE  (null)
ANTON (null)
LEE   BROWN
BROWN (null)

I want to get information from people who live in the same st and cities as mentors.

In the example I gave, it is JAMES who meets that condition. How could I get that information?..

my version oracle11g

Upvotes: 0

Views: 33

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269643

This sounds like two joins:

select pn.name
from mentor m join
     person pn
     on pn.name = m.name join
     person pm
     on pm.name = m.m_name
where pn.street = pm.street and pn.city = pm.city;

Upvotes: 1

Related Questions