sledjama Posted September 28, 2011 Share Posted September 28, 2011 Hello, I am working on a facebook style news feed, the feed you get to see when when you login to facebook that shows posts made by you and your friends. i am able to get posts made by friends with this query select members.username, wallpost.idx, poster_id, `post`, wall_id, `time`, member_info.picture from wallpost, member_info, members, friends where (( poster_id=friends.friend1_id and friends.friend2_id=?) or (poster_id=friends.friend2_id and friends.friend1_id=?)) and member_info.user_id=wallpost.poster_id and members.id=wallpost.poster_id order by idx desc LIMIT 0,50 getting data from 4 tables to fulfill what i want but it does not show posts made by me my id will be inserted where the question marks are. select members.username, wallpost.idx, poster_id, `post`, wall_id, `time`, member_info.picture from wallpost, member_info, members, friends where (( poster_id=friends.friend1_id and friends.friend2_id=?) or (poster_id=friends.friend2_id and friends.friend1_id=?) [b]or poster_id=?[/b]) and member_info.user_id=wallpost.poster_id and members.id=wallpost.poster_id order by idx desc LIMIT 0,50 adding the bolded part helped but it fetched dupplicates of my own posts while posts from friends is fine. thanks in advance Link to comment https://forums.phpfreaks.com/topic/248001-please-help-me-to-correct-this-query/ Share on other sites More sharing options...
fenway Posted September 28, 2011 Share Posted September 28, 2011 Hard to see join conditions with theta syntax. Link to comment https://forums.phpfreaks.com/topic/248001-please-help-me-to-correct-this-query/#findComment-1273702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.