MySQL Forums
Forum List  »  InnoDB

Re: Need Help With 3 Table Join
Posted by: Peter Brawley
Date: October 23, 2008 12:57PM

Here's a hint. To get pairs of friends, join twice:

SELECT CONCAT(pu.firstname,' ',pu.lastname) as user,concat(pf.firstname,' ',pf.lastname) as friend
FROM friends f
JOIN profiles pu ON f.uid=pu.uid
JOIN profiles pf ON f.friendid=pf.uid
order by user;

PB
http://www.artfulsoftware.com

Options: ReplyQuote


Subject
Views
Written By
Posted
4916
October 15, 2008 10:06AM
Re: Need Help With 3 Table Join
2367
October 23, 2008 12:57PM


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.