html - PHP query also show results for ID 75 -
i have following query. reason it's not showing results user under id: 75, me of course.
select if(friends.sender = 75, friends.recipient, friends.sender) id, users.firstname, users.lastname, feed.date, feed.time, feed.text, feed.userid, feed.ip friends join users on (users.id = if(friends.sender = 75, friends.recipient, friends.sender)) join feed on (users.id = feed.userid) friends.sender = 75 or friends.recipient = 75 , friends.status = 1 order feed.date desc, feed.time desc
taking little bit of guess @ you're attempting accomplish, assuming want return list of users , friends, should work:
select distinct users.id, users.firstname, users.lastname, feed.date, feed.time, feed.text, feed.userid, feed.ip users join friends on users.id in (friends.sender, friends.recipient) join feed on (users.id = feed.userid) 75 in (friends.sender,friends.recipient) , friends.status = 1 order feed.date desc, feed.time desc