如何在FQL查询中选择子字段?

时间:2014-01-16 11:12:19

标签: facebook facebook-fql fql.multiquery

我使用FQL获取有关用户帖子的信息。例如:

  Select likes from stream where post_id='100000481752xxx_828718160487568'

接下来回复我:

{
"data": [
        {
        "likes": {
         "href": "https://www.facebook.com/browse/likes/?id=828718160487568", 
        "count": 2, 
       "sample": [
                 100000640266xxx, 
                 100000481752xxx
                 ], 
      "friends": [
                 ], 
   "user_likes": false, 
     "can_like": false
                 }
        }
        ]
}

如何从“喜欢”中仅选择字段“count”和“sample”?

1 个答案:

答案 0 :(得分:1)

使用field.subfield以便:

SELECT likes.count, likes.sample 
  FROM stream 
 WHERE post_id='100000481752xxx_828718160487568'

结果:

{
  "data": [
    {
      "likes": { 
        "count": 2,
        "sample": [
                 100000640266xxx, 
                 100000481752xxx
        ]
      }
    }
  ]
}