Jump to content

Pulling data dynamically based on 2 SQL tables


Usarjjaco

Recommended Posts

Hello Everyone,Been awhile since I've meandered into the forums on here, but I'm banging my head against a wall trying to figure this one out.Set Up: I have 2 tables in a SQL database. One lists whether a person is a friend with another person. The second is an Activity table that lists what someone posts as a status update.Goal: I need to be able to display not only a users own status updates, but updates that any of their "friends" have posted.Right now I've only been able to pull the persons own feed with a simple query, and I'm wondering how I would go about pulling all feeds from anyone that they are friends with.Friends Table has the following fields: id, senderid, recipientid, status (Status can be 'N' for declined, 'Y' for accepted, and 'P' for pending, for the purposes of this problem, I only need to pull the friends with 'Y')The Activity table has: id, activity, posterid, recipientid.So basically a User A posts something. Then if he is friends with user B, user B would see that User A has posted something. Thanks in advance guys, and if there's any more information I can get to you to get a hand with this just let me know!

Link to comment
Share on other sites

justsomeguy, Seriously I want to send you a warm thank you and a +1. That was exactly what was needed, and for you to be able to extricate that from the garble that I placed above is truly above par. Thanks. Now, just so I don't fall victim to easy syndrome, I'm going to go reference what you've wrote and figure this out on my own as well. Thanks again!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...