AlexanderN
AlexanderN

Reputation: 2670

Facebook FQL Subquery

Im using the below query to fetch all the events that I have accepted the invitation to:

NSString *eventQuery = @"SELECT eid, name, creator FROM event WHERE eid IN 
( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='attending' )";

This works perfectly, but now I want to get the name of the creator too. Since the creator field is just the userid of the creator I have to do another subquery.

Can someone help me with this?

Thank you so much for your time!

Upvotes: 0

Views: 693

Answers (1)

cpilko
cpilko

Reputation: 11852

You need to issue an FQL multiquery to get this. I'm not sure of how you do this in Objective C, but the FQL syntax is:

{ 
   "user_events":
      "SELECT eid, name, creator FROM event WHERE eid IN 
        (SELECT eid FROM event_member WHERE uid=me() and rsvp_status='attending')",
   "event_creators":
       "SELECT name, id FROM profile WHERE id IN 
         (SELECT creator FROM #user_events)"   
 }

Your original problem with no "maybe" events getting returned is because rsvp_status='maybe' is incorrect. rsvp_status='unsure' is the correct syntax.

Upvotes: 2

Related Questions