I need to retrieve a specific group using FQL.
If you know the
gid of the
group, it’s as easy as:
SELECT name, description FROM group WHERE gid = $gid;
It’s a little trickier if you know the
name of the group but not the
gid. As long as the
user is a member of the group, you can do
SELECT gid, nid, description FROM group WHERE name = $name AND gid IN (SELECT gid FROM group_member WHERE uid = $user);
needs to be allowed to see the specified group or you’ll get back an
empty set. Two things to note if you’re looking up a group by
Groups aren’t unique by name, so you may well get more than one result back.
Remember that it’s an exact match, so you’ll need to get punctuation and capitalization exactly right.