
Originally Posted by
pbaldy
In a query, you'd add the person table twice. Access will alias the second instance with something like Person_1, which you can change. Then you join each of your fields to a different instance of the table.
I hope I'm not out of line for asking questions even though I'm not OP, but now I'm slightly confused.
I'm guessing the problem is they're using a many-to-many relationship table, a person's primary key could be found in one of two different foreign key fields in the many-to-many table. So what's the best way to to select ALL of a person's friends?
Maybe like this:
Code:
SELECT Friendships.PersonID1 AS FriendID
FROM Friendships
WHERE Friendships.PersonID2=[Forms]![Person]![ID]
UNION
SELECT Friendships.PersonID2 AS FriendID
FROM Friendships
WHERE Friendships.PersonID1=[Forms]![Person]![ID]
or this:
Code:
SELECT IIf([PersonID1]=[Forms]![Person]![ID],[PersonID2],[PersonID1]) AS FriendID
FROM Friendships
WHERE Friendships.PersonID1=[Forms]![Person]![ID] OR Friendships.PersonID2=[Forms]![Person]![ID]
I'll shut up now until OP chimes back in.