0

I have a list of users who uses my Facebook application (id1, id2, id3, ... idn).

I want to know what events my users are attending and how much of my users are in this event using a FQL command.

I tryed to use:

SELECT eid, COUNT(eid) AS users 
FROM event_member
 WHERE rsvp_status = 'attending' 
 AND uid IN (id1, id2, id3, ... idn)

but FQL doesn't support the COUNT command, anyone can help?

I'm using Java to make this collector.

Brayan Neves
  • 329
  • 1
  • 15

1 Answers1

1

You can't do count purely in FQL. You'd need to populate an array in your underlying program with the results of your query and get the length/count of the array.

For your particular problem, there's an attending_count field in the event table, which may be what you're after.

Nathan
  • 1,445
  • 9
  • 20
  • How can i use the attending_count of a list of users? – Brayan Neves Nov 30 '12 at 00:03
  • If you're wanting to know the attending count of a subset of users and not the event as a whole, you'd need to do it the way you have it originally and iterate over the array in your application. Update your question with more details if you'd like to know how in a specific language, ie. PHP. – Nathan Nov 30 '12 at 00:28
  • Java doesn't have a native JSON parser, you'll need to import JSONObject and JSONArray from [here](http://www.json.org/java/), then [this](http://stackoverflow.com/questions/2255220/how-to-parse-a-json-and-turn-its-values-into-an-array) should give you something to go by. – Nathan Nov 30 '12 at 01:29
  • I'm already using this Lib too, I just need to know how to count with fql. – Brayan Neves Nov 30 '12 at 19:42
  • Hi Brayan, there is no `count` in FQL. The 2nd link I provided will show you how to convert the JSON results of an FQL query to an array, which you can then count. This should give you the answer you're looking for. – Nathan Dec 03 '12 at 02:24