Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top