fenway Posted July 6, 2008 Share Posted July 6, 2008 This will return all the members who aren't already friend-ed: select friendid from members as m left join added as a on ( a.theirs = m.friendid ) where a.theirs is null Obviously, you'll need to limit it the current member.... Link to comment https://forums.phpfreaks.com/topic/108380-locked-tables/page/2/#findComment-582978 Share on other sites More sharing options...
acidglitter Posted July 13, 2008 Author Share Posted July 13, 2008 okay this is what i have now. nothing will show up when a.yours is there. but i'm not sure of how else to do it. because if it just said a.theirs IS NULL then every member would only get added once. i need it to select members that haven't been added by the member thats currently logged in. SELECT friendid FROM members AS m LEFT JOIN added AS a ON (a.theirs = m.friendid) WHERE a.yours='$friendid' AND a.theirs IS NULL Link to comment https://forums.phpfreaks.com/topic/108380-locked-tables/page/2/#findComment-588949 Share on other sites More sharing options...
corbin Posted July 13, 2008 Share Posted July 13, 2008 Try doing m.friendid = $friendid. But, I'm no positive I understand your table schema correctly, so I could be way off. Link to comment https://forums.phpfreaks.com/topic/108380-locked-tables/page/2/#findComment-588954 Share on other sites More sharing options...
fenway Posted July 14, 2008 Share Posted July 14, 2008 Then: SELECT friendid FROM members AS m LEFT JOIN added AS a ON (a.theirs = m.friendid AND a.yours='$friendid' ) WHERE a.theirs IS NULL Link to comment https://forums.phpfreaks.com/topic/108380-locked-tables/page/2/#findComment-589756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.