jaymc Posted February 2, 2008 Share Posted February 2, 2008 Table view User - Friend Dan - Amy Stacey - Amy I have a friends table, When stacey goes on Dans profile, I want to check the friends table and see if they have any of the same friends, in the example above, they are both friends with Amy I need to pull out Amy and display her as a 'friend in common' How can i best do this, needs to be efficient as the table is very large and heavily accessed Cheers Quote Link to comment https://forums.phpfreaks.com/topic/89089-solved-can-this-be-done-in-mysql/ Share on other sites More sharing options...
Barand Posted February 3, 2008 Share Posted February 3, 2008 SELECT a.friend FROM friends a INNER JOIN friends b ON a.friend = b.friend WHERE a.user = 'Dan' AND b.user = 'Stacey' Quote Link to comment https://forums.phpfreaks.com/topic/89089-solved-can-this-be-done-in-mysql/#findComment-456415 Share on other sites More sharing options...
jaymc Posted February 3, 2008 Author Share Posted February 3, 2008 Cheers Quote Link to comment https://forums.phpfreaks.com/topic/89089-solved-can-this-be-done-in-mysql/#findComment-456478 Share on other sites More sharing options...
chrischen Posted February 4, 2008 Share Posted February 4, 2008 Oops, posted in wrong topic.. Quote Link to comment https://forums.phpfreaks.com/topic/89089-solved-can-this-be-done-in-mysql/#findComment-457316 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.