I'm having some confusion with Facebook's fql.multiquery feature.
My goal is to fetch all the comments on a specific post and then retrieve the user information for each commenter. While I can easily get the comments, I am facing difficulty in obtaining the user details.
Currently, I am utilizing the code snippet below:
FB.api({
method: 'fql.multiquery',
queries: {
query1: 'SELECT post_fbid, fromid, text, time FROM comment WHERE post_id="'+postID +'"',
query2: 'SELECT id, name, url, pic FROM profile WHERE id IN (SELECT fromid FROM #query1)'
}
},
function(response) {
}
})
Upon using this, I receive the following response:
[
{
"name": "query1",
"fql_result_set": [
{
"post_fbid": "xxxxx",
"fromid": user1id,
"text": "Here's a comment",
"time": 1308579931
},
{
"post_fbid": "xxxxx",
"fromid": user2id,
"text": "Another comment",
"time": 1308580031
}
]
},
{
"name": "query2",
"fql_result_set": [
{
"id": user1id,
"name": "User 1 name",
"url": "User 1 url",
"pic": "User 1 pic"
},
{
"id": user2id,
"name": "User 2 name",
"url": "User 2 url",
"pic": "User 2 pic"
}
]
}
]
The issue I'm facing is how to link these two sets of data. I need to display each comment along with the corresponding user's name. How can I achieve this?
Alternatively, I'm open to suggestions for a more efficient approach to tackle this task.