MySQL Forums
Forum List  »  InnoDB

Need Help With 3 Table Join
Posted by: Brian Alston
Date: October 15, 2008 10:06AM

Hello All

I need help with a 3 table join that is driving me crazy. First, I'll describe the tables:

Table 1 = users:
id
uuid
username
password

Table 2 = profiles:
id
uid
firstName
lastName

Table 3 = friends:
id
uid
friendid


The "uid" in profiles and friends are keys to the "id" in users, that is how I tie all of my tables together. When a user adds a friend, the users "id" gets stored in the "uid" field of the friends table and the "id" of the friend gets stored in the "friendid" field of the friends table. What I want is a query to give me the uuid,firstName,lastName of the friends when I run a query for a particular users "id"; for example, if I want all of the friends for "Joe".

If somebody could help with this I would greatly appreciate it.

Thank you for reading.



Edited 2 time(s). Last edit at 10/15/2008 11:46AM by Brian Alston.

Options: ReplyQuote


Subject
Views
Written By
Posted
Need Help With 3 Table Join
4898
October 15, 2008 10:06AM
2360
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.