All pastes #445919 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-04-18 05:03 UTC
rendered paste body
// I have 2 tables. One called userInfo and one called infoFriends. userInfo contains a unique userid, firstname and lastname. infoFriends contains a NON unique userid (userids is the column name) and friend. I am trying to create a list where I select ALL userid from userInfo and display the results on the page, UNLESS the userid is a userid in the current session, OR the userid in userInfo is already matched up to the "friend" column that is paired with the userids (session id) in infoFriends.// How can I structure the SELECT to: find userid in the friend column and at the same time the session id in the userids and if they match, exclude that result from showing on the page?  SELECT userInfo.userid,userInfo.firstname,userInfo.lastname,infoFriends.userids,infoFriends.friend from userInfo, infoFriends where infoFriends.userids = '$useridinsert' AND userInfo.userid <> '$useridinsert'