John McDonnell
John McDonnell

Reputation: 13

FQL Multiquery Returned Info

I'm trying to use an FQL Multiquery to obtain my most recent Facebook question and options with one query using an http request.

So far the query I tried to use is:

SELECT name, votes FROM question_option WHERE question_id IN 
   (SELECT id, question FROM question WHERE owner = me() 
   ORDER BY created_time DESC LIMIT 1)

Unfortunately this only returns the name and votes from the outer query and not the question text from the inner one. Is there a way to retrieve all 3 without making 2 queries?

Upvotes: 1

Views: 214

Answers (1)

cpilko
cpilko

Reputation: 11852

What you posted isn't a multiquery. A proper multiquery should get you what you want:

{
'question_detail':
  'SELECT id, question FROM question WHERE owner = me() 
     ORDER BY created_time DESC LIMIT 1',
'question_answers':
   'SELECT name, votes FROM question_option WHERE question_id IN
      (SELECT id FROM #question_detail)'
 }

You'll need to get rid of the whitespace for this to properly execute.

Upvotes: 1

Related Questions