Facebook API,通过他的ID获取朋友的名字

时间:2013-02-13 19:01:59

标签: facebook facebook-fql

我写了一个FQL查询来获取标记我的朋友的名字 -

这是FQL查询,它给出了朋友ID的列表(It's Works):

SELECT owner FROM photo WHERE object_id IN(SELECT object_id FROM photo_tag WHERE subject = me())

现在我想通过查询得到他们的名字:

SELECT name FROM user WHERE uid IN(SELECT owner FROM photo WHERE object_id IN(SELECT object_id FROM photo_tag WHERE subject = me()))

但是我没有得到名称的完整列表,它停止并给出了这个错误 - “Uncaught TypeError:无法读取未定义的属性'名称'

1 个答案:

答案 0 :(得分:0)

您的查询可能失败,因为内部查询返回的某些owner ID不属于用户。请尝试使用profile表:

SELECT name FROM profile WHERE id IN 
  (SELECT owner FROM photo WHERE object_id IN 
    (SELECT object_id FROM photo_tag WHERE subject=me()))