With an FQL request you have the ability to use the core Boolean logical operators—AND, OR and != (not equal to). Combine these with subqueries and you've got a lot of power available to help you filter out results from your queries.
In this recipe we're going to use subqueries and logical operators to retrieve a list of Facebook user objects. We'll be using a nested subquery to get a list of other Facebook users that the current user is tagged in photos with. We're then going to use the OR
operator to expand our search results, and include all of the current user's friends, so our overall query will return both friends and tagged users.
Once we have that list, we're going to flip the results and use the AND
operator to exclude results, and only return a list of users that are both friends and tagged in photos alongside the current user.