2012-11-04 79 views
0

簡單的說。我需要幫助建立一個FQL多查詢請求,將做到以下幾點:FQL Multiquery寫入連接查詢

  1. 抓住從登錄用戶的好友列表,然後,
  2. 的UID使用這些ID抓住所有的評論和消息(來自流)從過去兩週
  3. 最後,加入這些結果與使用者名稱有

繼承人的查詢,我至今:

[1] GRAB_UI DS

SELECT uid2 FROM friend WHERE uid1 = me() 

[2] GRAB_STREAM(缺失2周部分和可能的錯誤共):

SELECT type, created_time, post_id, comments, actor_id, target_id, message 
FROM stream 
WHERE filter_key IN 
     (SELECT filter_key FROM stream_filter WHERE uid = me()) 
AND actor_id IN 
     (SELECT uid2 FROM friend WHERE uid1 = me()) 
)'; 

[3] GRAB_USRNAMES

SELECT uid, name, username, pic_square, current_location, profile_url 
FROM user WHERE uid IN 
     (SELECT uid2 FROM friend WHERE uid1 = me()) 

我真的可以使用大師來提出這種請求,我非常感謝幫助。

回答

4
{ 
    "query1":"SELECT uid2 FROM friend WHERE uid1 = me()", 
    "query2":"SELECT type, created_time, post_id, comments, actor_id, target_id, message FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid = me()) AND actor_id IN (SELECT uid2 FROM #query1)", 
    "query3":"SELECT uid, name, username, pic_square, current_location, profile_url FROM user WHERE uid IN (SELECT uid2 FROM #query1)" 
} 

您還可以看到從圖形API瀏覽器,結果在:

https://developers.facebook.com/tools/explorer?fql={%22query1%22%3A%22SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%22%2C%22query2%22%3A%22SELECT%20type%2C%20created_time%2C%20post_id%2C%20comments%2C%20actor_id%2C%20target_id%2C%20message%20FROM%20stream%20WHERE%20filter_key%20IN%20%28SELECT%20filter_key%20FROM%20stream_filter%20WHERE%20uid%20%3D%20me%28%29%29%20AND%20actor_id%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22%2C%22query3%22%3A%22SELECT%20uid%2C%20name%2C%20username%2C%20pic_square%2C%20current_location%2C%20profile_url%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22}

+0

感謝偉大的答案。 – vsiege