Retrieving a User’s Friends’ Listings

Problem

I need to retrieve all of a specified user’s friends’ listings using FQL.

Solution

SELECT title, url, description, price, category FROM
 listing WHERE poster IN (SELECT uid2 FROM friend WHERE uid1 = $user);

Discussion

Since this is based on a query on the friend table, you can make it only when user is the current loggedinuser.

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.