Jump to content

Pulling data dynamically based on 2 SQL tables

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...