-6

I use this code for get my friends where i'm a member of.but not work...!

select uid2 from friend where uid1 IN (SELECT uid FROM group_member WHERE gid = '111111111')

ekad
  • 14,436
  • 26
  • 44
  • 46
  • 1
    How do you know that it doesn't work? – user35443 Jun 01 '13 at 12:55
  • i try with facebook tools explorer.this the code error :"error": { "message": "Can't lookup all friends of 100004015920032 due to user's privacy settings.", "type": "NoIndexFunctionException", "code": 604 – Ratna Wulan Jun 01 '13 at 13:04
  • I guess user 100004015920032's privacy settings don't let you look up their friends list, then? – Igy Jun 01 '13 at 17:26

1 Answers1

2

this should work:

select uid,gid  from group_member where gid in (select gid from group_member where uid=me()) order by gid

It get all the user id and group id from the group where group id is in a group in where you are member.

BUt I suggest you to split it in 2 query: get the ids of the group where you are in and then get, for each group, the ids of the members

select gid from group_member where uid=me()

and then loop through the results

select uid from group_member where gid ={group_id}

for the users data:

Pay attention: more the query is complicated, more will be the time needed

select name from user where uid in(select uid  from group_member where gid in (select gid from group_member where uid=me()))

so i suggest, for each group:

select name from user where uid in(select uid from group_member where gid ={group_id})


here is the user table reference so you can add the fields needed in addition to 'name'