MySQL Forums
Forum List  »  Newbie

Using table twice in query
Posted by: Parker Shannon
Date: March 15, 2021 03:58AM

How do I do this in MySQL?

Table: person
id
name
first_name
last_name
etc

Table: relation
person_id
related_person_id
relationship

SELECT person.name, relation.relationship, person(alias).name
FROM person, relation, person(alias)
WHERE person.id = relation.person_id AND relation.related_person_id = person(alias).id

Options: ReplyQuote


Subject
Written By
Posted
Using table twice in query
March 15, 2021 03:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.