Reputation: 17530
I'm creating an app where user will be able to select some of his friends then the app will do some job on the selected friends.
My question is =->
Can I directly write this FQL?
SELECT uid, name, pic_square FROM user WHERE uid = $friendUID
Or Do I need to write something like this?
SELECT uid, name, pic_square FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) and UID = $friendUID
Upvotes: 0
Views: 1547
Reputation: 57836
Both queries are same.
1. SELECT uid, name, pic_square FROM user WHERE uid = $friendUID
2. SELECT uid, name, pic_square FROM user WHERE
uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) and UID = $friendUID
In 1st query, you are directly accessing data by directly Friends Id.
In 2nd query, you are checking uid is also friend or not and then accessing data.
You can use 1st query to check any user's data though he/she might not be your friend. For uid, name, pic_square there is no any requirement that user is your friend or app user. You can get that information of any Facebook user.
Upvotes: 0
Reputation: 17530
http://developers.facebook.com/docs/reference/rest/fql.query/
it showed that both are correct
Upvotes: 1