title: Alternatives to using a SQL UNION in this query?
body: <p>I have a friends table with columns user1 and user2 and a users table with a login field.</p>
  
  <p>A friend "pair" can be stored either way, for example user1=Joe and user2=Dave, or it could be user1=Dave and user2=Joe, same thing.</p>
  
  <p>I want to find all friends of a user (say "Joe") that have been logged in within the last 30 days (I'm not concerned about the date format, just want to be able to do it in 1 query).</p>
  
  <p>Is using a UNION the only solution, does it have the best performance?</p>