By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,375 Members | 3,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,375 IT Pros & Developers. It's quick & easy.

User and Friends Database Structure

P: 2
Hi need help
I have a table "User" (including friends). Each user can have one or more friends which are users too. So my two tables look like this

userID (primary)

userID (secondary)
friendID (secondary)

How do get the query to print the name of the friend the user is a friend of?

As it is i get from the query

UserID Name FriendID and i dont know how to get the name of the friend who is a user. Thanks
Jan 21 '14 #1
Share this Question
Share on Google+
2 Replies

P: 2
Oh and it doesn't matter if A is a friend of B or B is a friend of A. Or that friend request accepted or blocked or anything like that.
Jan 21 '14 #2

Expert Mod 10K+
P: 12,366
Join the friend table to the user table twice.
Jan 21 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.