FQL NOT IN等效运算符,如<> ,除了,!=

时间:2012-05-09 16:04:26

标签: php facebook-fql

我正在尝试开发此代码:

$users = $facebook->api(array(
  'method' => 'fql.query',
  'query' =>    "SELECT uid, last_name, pic_big"
             + " FROM user WHERE uid IN ("
             + "     SELECT uid" 
             + "     FROM page_fan"
             + "     WHERE page_id='411133928921438'" 
             + "         AND uid IN ("
             + "             SELECT uid2 FROM friend WHERE uid1 = me()"
             + "         )"
             + ")"
));

我的想法是我不想使用运算符IN而不是IN,但是FQL不支持NOT IN等运算符,除了......我怎么能用FQL做这个?...

3 个答案:

答案 0 :(得分:15)

Facebook确实支持NOT IN。你只需将它包裹在足够的parantheses中。

例如,要查找与当前用户不同的当前用户或朋友的用户:

SELECT uid, name FROM user WHERE uid IN (
  SELECT uid FROM event_member WHERE eid=209798352393506
)
AND NOT (uid=me())
AND NOT (uid IN (
  SELECT uid1 FROM friend WHERE uid2=me()
))

答案 1 :(得分:2)

刚刚找到了办法NOT IN并且不得不分享快乐新闻;)

SELECT post_id, actor_id, message FROM stream WHERE source_id in(a, b, c) and NOT (actor_id in (a, b, c))

这将由未知用户从多个页面获取消息,即用户的所有帖子或不是页面本身的页面,也就是粉丝。

答案 2 :(得分:1)

FQL中没有 NOT IN 运算符。您可以使用 IN 进行简单的选择,并使用PHP进行否定。这有点开销,但据我所知,这是唯一的方法。

我找到了相关帖子:link here