0

I am building a site that needs to query Facebook events. I need a list of events I do own, and list of events I don't own. The problem is that querying the Events object via FQL requires that I pass one of the indexable fields. Those are creator, name, and eid. This is fine when I need my events (creator = me()). However, when I need events I don't own I can't seem to use a SQL like statement in (creator <> me()).

Any suggestions on how to do this?

SELECT name,start_time,end_time,location,eid,pic,description FROM event where creator = me() and start_time >= 1370106582

Steve H.
  • 350
  • 3
  • 9

1 Answers1

0

It's not as straightforward as I would like but this query works.

SELECT name,start_time,end_time,location,eid,pic,description FROM event where eid IN
 (SELECT eid FROM event_member WHERE uid = {UserId} and inviter and rsvp_status = 'attending')


If you query for event_member by the Users Id the Inviter field with be null for events in which they are the owner. In FQL if you just add 'Where {field}' in a where clause, it returns all the results in which that field's value is not null. I know that's a bit confusing but it works.

Steve H.
  • 350
  • 3
  • 9