jaipai — 2012-06-24T23:04:30-04:00 — #1
I've been making a small social media app and as most social media apps it must have a friends list. I've organized my friends table very simply. It contains 3 fields: id, friend1, friend2. I'm not certain this is the best method but so I've been told.
I know very basic MySQL but trying to learn more advanced combinations of sql functions. What I want to achieve is selecting all the friend1 or friend2 that is not = to username but the username must be one of friend1 or friend2.
I'm also trying to join tables, to obtain the user data, so SELECT username, picture from the database.
Could anyone point me in the right direction?
It would be greatly appreciated.
guelphdad — 2012-06-24T23:58:08-04:00 — #2
The id field is not necessary. you'd have an id for Friend1 and an id for Friend2, the additional id field offers no necessary information.
Did you search the forum for FRIEND since the question is likely to have been asked and answered a number of times?
jaipai — 2012-06-25T00:09:01-04:00 — #3
Woops. Sorry about that. Haven't been using sitepoint in a while. Got my answer. Thanks
mittineague — 2014-09-22T12:08:03-04:00 — #4
This topic is now archived. It is frozen and cannot be changed in any way.