Trying to create a query that generates a list of users that :
A.) the loggedin user is not already following
B. ) the loggedin user has not already viewed and skipped ( FOLLOWER_SWIPES table)
Here is my query, for some reason it is still showing users that the loggedin user has skipped in the past:
SELECT u.uid, u.full_name, u.bio, u.thumb_img, u.college, u.HEADER_IMG
FROM users AS u
WHERE u.uid <>'$uid'
AND u.uid <> ANY(
SELECT FOLLOWING_UID_FK
FROM FOLLOWERS
WHERE UID_FK='$uid'
)
AND u.uid <> ANY(
SELECT SWIPPED_UID_FK
FROM FOLLOWER_SWIPES
WHERE UID_FK =$uid
)
AND u.college_id='$college'
ORDER BY u.last_feed_load DESC
LIMIT 0 , 30
The condition:
is not a very restrictive condition. Try using
ALL
instead ofANY
:Or use the equivalent: