473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

User and Friends Database Structure

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

tblUser
userID (primary)
name

tblFriend
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
2 1133
MWBN
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
Rabbit
12,516 Expert Mod 8TB
Join the friend table to the user table twice.
Jan 21 '14 #3

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

Similar topics

1
by: Maarten Hendrikx | last post by:
Hi, We're planning a web application which will allow teachers to plan their teacher diary online. So for instance: Mondag 8.50 - 9.40 --> Math (First Grade) Mondag 9.40 - 10.30 --> French...
3
by: Bart | last post by:
Hello I am looking for something like visual database structure browser. I need to see all tables and relations beetween them. Something like "Relations" window in Microsoft database products...
0
by: Aleksey | last post by:
Hello, I need to collect some information on changes in database structure for further analysis. I'm interested in the following information: - new and dropped tables and views; - new and...
1
by: Sue | last post by:
Hi again, How can I copy the DB2 database structure alone without copying the data from the tables? I am using DB2 workgroup server versio 8.1. Thanks again!
5
by: Pato Secruza | last post by:
How can I print the database structure, including non default variables like Requiered, FieldSize, and most important DESCRIPTION. I want a table like this: ...
1
by: Xerxes | last post by:
Hi, is there a way of exporting database structure not the data in it? Thanks.
2
by: lihard | last post by:
Hi, I would like to know if there are laws in any state that prohibits anyone from using someone else's database structure and stored procedures. I would like to think that if someone's else got...
2
by: LeXave | last post by:
Hi all I've got the following problem in my database structure : I have a table "User". Each user can have one or more friends which are users too. And I have no idea about the way I must think...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.