I could use help with the following query which is for suggesting friends to a user
I have three models:
User (id, fb_id, org_id)
FbFriends (user_id, fb_id, org_id)
Friendships (user_id, friend_id)
FbFriends is caching the user's friends on Facebook. Friendships is a friendship on my app.
Goal, Return Users based on the following conditions:
- Sorted by the User's org_id
- Filter out anyone if their is already a Friendship record between the two users.
Is it possible to return @users based on the above with one query? Or do I need to build this with multiple queries?
Thanks