I'm having trouble with some SQL logic for mutual friends.
Say I have 2 variables, user1, and user2. What can I do to find out the mutual friends of these two users?
My friends table is:
friend1, friend 2, requestor and status.
When someone is a friend with each other the entry goes both ways. So.
friend1 = user1, friend2 =user2 AND friend1 = user2, friend2 = user1.
Now how can I find a mutual friend? How can I take user1 = friend1 and take friend2 to check whether user2 is friends with friend2?
Thanks for your help.