I'm new in sql. I got stuck into this problem, and I can't figure it out how can I solve this.
I've got 2 tables.
The problem is: How can I return with one query the person's name and the other's name, whom they knew.
You would use two join
s:
select pr.*, p.name, ppr.name as rel_name
from personRel pr left join
person p
on p.personid = pr.personid left join
person ppr
on ppr.personid = pr.relid;