查找不在任何朋友列表上的Facebook好友

时间:2011-11-23 22:51:04

标签: facebook

这就是问题所在,如何让用户朋友不在任何用户的朋友列表上?

这让我看到列表中的每个人:

  

从用户WHERE uid IN中选择uid,last_name,name,current_location   (SELECT uid2 FROM friend WHERE uid1 = me()AND uid2 IN(SELECT uid FROM   friendlist_member WHERE flid IN(SELECT flid FROM friendlist WHERE   owner = me()AND type =“user_created”)))ORDER BY last_name LIMIT 0,10

但这对我没有任何帮助:

  

从用户WHERE uid IN中选择uid,last_name,name,current_location   (SELECT uid2 FROM friend WHERE uid1 = me()AND uid2 NOT IN(SELECT uid   FROM friendlist_member WHERE flid IN(SELECT flid FROM friendlist   WHERE owner = me()AND type =“user_created”)))ORDER BY last_name LIMIT   0,10

似乎每当我包含带有“NOT IN(...)”的子句时,都会返回一个空集。

1 个答案:

答案 0 :(得分:0)

如果任何值NOT IN (a, b, ..., n)为NULL,则表达式a, b, ..., n将返回NULL。如果uid可以为null,请尝试向内部select中的WHERE子句添加一个额外条件以删除NULL值:

SELECT uid
FROM friendlist_member
WHERE flid IN (SELECT flid FROM friendlist WHERE owner=me() AND type = "user_created"
AND uid IS NOT NULL