Greetings All, I'm relatively new to the database world and I'm stuck on a pretty basic problem.. perhaps someone here can help
I have a simple Friends Table set up as follows:
[ AccountID | FriendID ]
Where a friend connection between Person1 and Person 2 would have two rows: (1,2) and (2,1). Thus if 3 has a pending request for 1 the row (3,1) exists but Not it's reciprocal (1,3).
I wrote a statement to see if PersonA and PersonB are Friends..:
SELECT * FROM Friends WHERE AccountID = 'PersonA' AND FriendID='PersonB'
UNION
SELECT * FROM Friends WHERE AccountID = ' PersonB' AND FriendID='PersonA';
Now I'm really stuck... how would I write a query to find only Pending Friend Requests for PersonA?