I've got 2 SQL tables:
NAMES just has 2 columns:
name_id. The other is a list of relationships between people in the
NAMES table. It has 3 columns:
name_ids from the
NAMES table. Each person in
NAMES can have multiple entries in either the primary or related columns of
RELATIONSHIPS (is that a many-to-many relationship?).
This query works:
SELECT people.name AS 'primary', relationships.related_person_id AS relatedto FROM relationships JOIN people ON people.name_id=relationships.primary_person_id ORDER BY people.name_id;
But I'd like to show a name (i.e. text) in the
relatedto column rather than the id number. How can I do that?