title: Would a subquery be ideal to check friendship of users? (and if they are friends back)
body: <p>I basically have a <code>friend</code> table with two primary columns, uid and fid (user/friend id's) and they could go either way, for example a user could befriend somebody and have an entry, although the friend may not have befriended the specific user back and I would like to check for this.</p>
  
  <p>Untested, however I envisioned something like this to work:</p>
  
  <pre><code>  SELECT fid FROM friends WHERE uid = 20  -- check friends of uid 20
  AND 
    (SELECT uid FROM friends WHERE fid = 20)) = 0 
  </code></pre>
  
  <p>I assume it isn't as easy as this (and if 0 can really check the result or if it is needed), however do you have any suggestions on how to do this without subqueries? Or is this the best "hack" that could be done without two separate queries and result checking code in my server side language?</p>
  
  <p>I would also like to check if they are both friends and whatnot in the future, so I could make use of a better example from here.</p>