Hello I am having a hard time trying to SELECT all of the information I need from two tables, the following two tables are:
Person: |id|fname|mname|lname| and Related: |id1|id2|relationship|
and I want the following to be displayed back from the SELECT query:
|id1|fname(of id1)|id2|fname(of id2)|relationship|
SO the Related table has two id's that are FOREIGN KEYS to Person(id), and I need to SELECT id1, (id1's first name), id2, (id2's firstname), and the relationship.
I've tried something like this and a few other SELECT queries but I can't seem to get it to work:
SELECT p.fname, r.id1, r.id2, r.relationship
FROM Person p, Related r
INNER JOIN Related ON first.id = r.id1
INNER JOIN Related ON second.id = r.id2;
Any help will be greatly appreciated! Thank you!