how can we count total friend to specific uid
+2
A:
COUNT
is not supported by FQL:
SELECT uid2
FROM friend
WHERE uid1 = USERID
Since COUNT
is not supported you need to get all of the records and then count them in whatever application that is making the SQL call.
If you want to get more information, like names, along with count you can use an inner select to get the friend's extended info:
SELECT name
FROM user
WHERE uid IN (SELECT uid2
FROM friend
WHERE uid1 = USERID)
Here is a related SO question:
References for Friend table:
Query this table to determine whether two users are linked together as friends.
Kelsey
2010-08-20 01:18:22