如何使用join重写下面的子查询。
select name
from person p
where exists (select *
from friends r, person p2
where r.name1 = p.name and p2.name = r.name2 and p.address = p2.address)
答案 0 :(得分:0)
select
p1.name
from
friends r
inner join person p1 on (p1.name=r.name1)
inner join person p2 on (p2.name=r.name2 and p2.address=p1.address)