User/Subscriber sql query

maltsev

New Member
I'm creating a table that shows all the registered users to which the current user has not yet subscribed to. But once he has subscribed someone, I need to filter that list to exclude those. Let's say the theres a table called subscribed which lists the User and to whom he is subscribed to.\[code\]|UserId||SubscriberID|\[/code\]Its easy to make it into multiple queries, but I've been unsuccessfully trying to make it into one query, to save an extra loop of MySQL calls.Here's What I have so far:\[code\] SELECT u.UserID, FullName, UserName from users u LEFT JOIN subscribed t ON ((u.UserName LIKE '%$search%' OR u.Email LIKE '%$search%') AND ({$_SESSION['ID']} = t.UserID AND t.FollowerID != u.UserID) )\[/code\]I know the last part of the query is wrong, since I only compare if the UserID and the FollowerID don't match for one particular row, not the entire table.
 
Back
Top